ASMBits
asmbits_wiki
https://asmbits.01xz.net/wiki/Main_Page
MediaWiki 1.27.1
first-letter
Media
Special
Talk
User
User talk
Project
Project talk
File
File talk
MediaWiki
MediaWiki talk
Template
Template talk
Help
Help talk
Category
Category talk
HDLBits
HDLBits talk
Template:NoTitle
10
11
14
2016-09-27T09:43:29Z
Henry
1
Created page with "<html><style>h2#firstHeading { display: none; }</style></html>"
wikitext
text/x-wiki
<html><style>h2#firstHeading { display: none; }</style></html>
f9e24a43f6ce1878815ab4774c0607a5db76a8c3
15
14
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<html><style>h2#firstHeading { display: none; }</style></html>
f9e24a43f6ce1878815ab4774c0607a5db76a8c3
Template:HintBox
10
8
8
2016-09-28T09:17:24Z
Henry
1
wikitext
text/x-wiki
<html><div class="hb-box" id="hintbox"><button onclick="$(this).next('div').toggle();">Hint...</button>
<div style="border: 0; display: none; margin-top: 1ex;">
</html>
{{{1}}}<html></div></div></html>
1041edbe34c3385143afec0162786f3679f59ae3
9
8
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<html><div class="hb-box" id="hintbox"><button onclick="$(this).next('div').toggle();">Hint...</button>
<div style="border: 0; display: none; margin-top: 1ex;">
</html>
{{{1}}}<html></div></div></html>
1041edbe34c3385143afec0162786f3679f59ae3
Template:ProblemHeader
10
14
20
2016-09-29T23:32:32Z
Henry
1
wikitext
text/x-wiki
<div style="border-bottom:2px #c6e9f2 solid; padding: 0.5ex 0 0 0; margin-top: -1ex; margin-bottom: 1em;">{{NextPrevBox|{{{1|{{lcfirst:{{PAGENAME}}}} }}} }}</div>
be826f6a9f87d25d23362783c79615a290b347cb
21
20
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<div style="border-bottom:2px #c6e9f2 solid; padding: 0.5ex 0 0 0; margin-top: -1ex; margin-bottom: 1em;">{{NextPrevBox|{{{1|{{lcfirst:{{PAGENAME}}}} }}} }}</div>
be826f6a9f87d25d23362783c79615a290b347cb
Template:NextPrevBox
10
9
10
2016-10-11T07:23:57Z
Henry
1
wikitext
text/x-wiki
<div class="row" style="margin-bottom: 0;">
<div class="column small-6"><span style="white-space:nowrap; margin-left:1ex;"><span class="fa fa-arrow-left"></span><span style="padding: 0.5em 0 0.5em 0.5em;">{{#vlgnextprev: {{{1}}} | -1 }}<small class="show-for-medium-up" style="margin-left: 1.5em; color:#aaa;">Previous</small></span></span></div>
<div class="column small-6" style="text-align:right;"><span style="white-space:nowrap; margin-right:1ex;"><span style="padding: 0.5em 0.2em 0.5em 0;"><small class="show-for-medium-up" style="margin-right: 1.5em; color:#aaa;">Next</small>{{#vlgnextprev: {{{1}}} | 1}}</span><span class="fa fa-arrow-right"></span></span></div>
</div>
40ef8a91c916fa676330f6ac0575df5304a671f1
11
10
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<div class="row" style="margin-bottom: 0;">
<div class="column small-6"><span style="white-space:nowrap; margin-left:1ex;"><span class="fa fa-arrow-left"></span><span style="padding: 0.5em 0 0.5em 0.5em;">{{#vlgnextprev: {{{1}}} | -1 }}<small class="show-for-medium-up" style="margin-left: 1.5em; color:#aaa;">Previous</small></span></span></div>
<div class="column small-6" style="text-align:right;"><span style="white-space:nowrap; margin-right:1ex;"><span style="padding: 0.5em 0.2em 0.5em 0;"><small class="show-for-medium-up" style="margin-right: 1.5em; color:#aaa;">Next</small>{{#vlgnextprev: {{{1}}} | 1}}</span><span class="fa fa-arrow-right"></span></span></div>
</div>
40ef8a91c916fa676330f6ac0575df5304a671f1
Template:ProblemFooter
10
13
18
2016-10-11T07:24:14Z
Henry
1
wikitext
text/x-wiki
<div style="border-top:2px #c6e9f2 solid; padding: 1ex 0 0 0; margin: 4em 0 2em 0;">{{NextPrevListBox|{{{1|{{lcfirst:{{PAGENAME}}}} }}} }}{{NextPrevBox|{{{1|{{lcfirst:{{PAGENAME}}}} }}} }}
</div>
8ebcee5b381f8a94d925956766c5b4383df9cb36
19
18
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<div style="border-top:2px #c6e9f2 solid; padding: 1ex 0 0 0; margin: 4em 0 2em 0;">{{NextPrevListBox|{{{1|{{lcfirst:{{PAGENAME}}}} }}} }}{{NextPrevBox|{{{1|{{lcfirst:{{PAGENAME}}}} }}} }}
</div>
8ebcee5b381f8a94d925956766c5b4383df9cb36
Template:NextPrevListBox
10
10
12
2016-10-11T07:30:35Z
Henry
1
wikitext
text/x-wiki
<div class="show-for-medium-up" style="position:relative; height: 1.6em;"><div style="white-space:nowrap; text-align: center; font-size:0.67em; overflow:hidden; position:absolute; top:0.5ex; left:3em; right: 3em;">
<div style="position: relative; text-align: right; width: 0%; display:inline-block; vertical-align: top;">
<div style="position: absolute; right: 0; display: block; display:inline-block;">
<ul class="hlist" style="margin:0.2em 0 0 0;">
<li>{{#vlgnextprev: {{{1}}}|-8|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-7|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-6|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-5|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-4|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-3|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-2|}}</li>
<li>{{#vlgnextprev: {{{1}}} |-1|}} · </li>
</ul></div>
</div><div style="display:inline-block; vertical-align: top;"><p style="margin:0 0.5em; font-size: 1.25em;">'''{{#vlgnextprev: {{{1}}}|0|}}'''</p></div>
<div style="width:0%; display:inline-block; text-align: left; ;vertical-align: top;">
<ul class="hlist" style="margin:0.2em 0 0 0;">
<li> · {{#vlgnextprev: {{{1}}}|1|}}</li>
<li>{{#vlgnextprev: {{{1}}}|2|}}</li>
<li>{{#vlgnextprev: {{{1}}}|3|}}</li>
<li>{{#vlgnextprev: {{{1}}}|4|}}</li>
<li>{{#vlgnextprev: {{{1}}}|5|}}</li>
<li>{{#vlgnextprev: {{{1}}}|6|}}</li>
<li>{{#vlgnextprev: {{{1}}}|7|}}</li>
<li>{{#vlgnextprev: {{{1}}}|8|}}</li>
</ul>
</div>
</div></div>
02aea6d32423101c78f39cf479ba996baae8bfaa
13
12
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<div class="show-for-medium-up" style="position:relative; height: 1.6em;"><div style="white-space:nowrap; text-align: center; font-size:0.67em; overflow:hidden; position:absolute; top:0.5ex; left:3em; right: 3em;">
<div style="position: relative; text-align: right; width: 0%; display:inline-block; vertical-align: top;">
<div style="position: absolute; right: 0; display: block; display:inline-block;">
<ul class="hlist" style="margin:0.2em 0 0 0;">
<li>{{#vlgnextprev: {{{1}}}|-8|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-7|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-6|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-5|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-4|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-3|}}</li>
<li>{{#vlgnextprev: {{{1}}}|-2|}}</li>
<li>{{#vlgnextprev: {{{1}}} |-1|}} · </li>
</ul></div>
</div><div style="display:inline-block; vertical-align: top;"><p style="margin:0 0.5em; font-size: 1.25em;">'''{{#vlgnextprev: {{{1}}}|0|}}'''</p></div>
<div style="width:0%; display:inline-block; text-align: left; ;vertical-align: top;">
<ul class="hlist" style="margin:0.2em 0 0 0;">
<li> · {{#vlgnextprev: {{{1}}}|1|}}</li>
<li>{{#vlgnextprev: {{{1}}}|2|}}</li>
<li>{{#vlgnextprev: {{{1}}}|3|}}</li>
<li>{{#vlgnextprev: {{{1}}}|4|}}</li>
<li>{{#vlgnextprev: {{{1}}}|5|}}</li>
<li>{{#vlgnextprev: {{{1}}}|6|}}</li>
<li>{{#vlgnextprev: {{{1}}}|7|}}</li>
<li>{{#vlgnextprev: {{{1}}}|8|}}</li>
</ul>
</div>
</div></div>
02aea6d32423101c78f39cf479ba996baae8bfaa
Template:PortlistBox
10
12
16
2016-10-22T21:25:37Z
Henry
1
wikitext
text/x-wiki
{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} {{#ifeq: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} | 1 | line | lines}}.''</p>|}}<div id="portlistouterbox" class="hb-box"><html><h3>Module Declaration</h3></html>
<pre<includeonly></includeonly> id="portlistbox">{{{1}}}</pre>
<pre<includeonly></includeonly> style="display:none;">{{{2|}}}</pre></div>
<noinclude>This template has three parameters:
*1: This is the module declaration, embedded in a <pre> tag with id=portlistbox. This will be displayed, and the SubmitBox template will copy-paste the text here into the submit textarea.
*2: This is optional, and is the text for a <pre> that won't be displayed. The SubmitBox template will ''also'' append this parameter into its textarea. This is used to provide code sample/structure that won't be shown in the PortlistBox. It seems like leading whitespace is trimmed, so start this with a // comment.
* len : If defined, this emits a "Expected solution length" line immediately before the PortlistBox.
</noinclude>
1779a8ca5408707216700c0c4b7509844d2627bd
17
16
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} {{#ifeq: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} | 1 | line | lines}}.''</p>|}}<div id="portlistouterbox" class="hb-box"><html><h3>Module Declaration</h3></html>
<pre<includeonly></includeonly> id="portlistbox">{{{1}}}</pre>
<pre<includeonly></includeonly> style="display:none;">{{{2|}}}</pre></div>
<noinclude>This template has three parameters:
*1: This is the module declaration, embedded in a <pre> tag with id=portlistbox. This will be displayed, and the SubmitBox template will copy-paste the text here into the submit textarea.
*2: This is optional, and is the text for a <pre> that won't be displayed. The SubmitBox template will ''also'' append this parameter into its textarea. This is used to provide code sample/structure that won't be shown in the PortlistBox. It seems like leading whitespace is trimmed, so start this with a // comment.
* len : If defined, this emits a "Expected solution length" line immediately before the PortlistBox.
</noinclude>
1779a8ca5408707216700c0c4b7509844d2627bd
26
17
2016-11-24T10:42:44Z
Henry
1
wikitext
text/x-wiki
{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} {{#ifeq: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} | 1 | line | lines}}.''</p>|}}<div id="portlistouterbox" class="hb-box"><html><h3>Entry point</h3></html>
<pre<includeonly></includeonly> id="portlistbox">{{{1}}}</pre>
<pre<includeonly></includeonly> style="display:none;">{{{2|}}}</pre></div>
<noinclude>This template has three parameters:
*1: This is the module declaration, embedded in a <pre> tag with id=portlistbox. This will be displayed, and the SubmitBox template will copy-paste the text here into the submit textarea.
*2: This is optional, and is the text for a <pre> that won't be displayed. The SubmitBox template will ''also'' append this parameter into its textarea. This is used to provide code sample/structure that won't be shown in the PortlistBox. It seems like leading whitespace is trimmed, so start this with a // comment.
* len : If defined, this emits a "Expected solution length" line immediately before the PortlistBox.
</noinclude>
4d9c54fd9eec4c814426e3a8c4b5e8e26b04db92
46
26
2016-11-26T02:14:37Z
Henry
1
wikitext
text/x-wiki
{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} {{#ifeq: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} | 1 | line | lines}}.''</p>|}}<div id="portlistouterbox" class="hb-box"><html><h3>Example Test Case</h3></html>
<pre<includeonly></includeonly> id="portlistbox">{{{1}}}</pre>
<pre<includeonly></includeonly> style="display:none;">{{{2|}}}</pre></div>
<noinclude>This template has three parameters:
*1: This is the module declaration, embedded in a <pre> tag with id=portlistbox. This will be displayed, and the SubmitBox template will copy-paste the text here into the submit textarea.
*2: This is optional, and is the text for a <pre> that won't be displayed. The SubmitBox template will ''also'' append this parameter into its textarea. This is used to provide code sample/structure that won't be shown in the PortlistBox. It seems like leading whitespace is trimmed, so start this with a // comment.
* len : If defined, this emits a "Expected solution length" line immediately before the PortlistBox.
</noinclude>
7fc5839ad76020ef9b93d6c969e100c030e3f9cb
Template:SubmitBox
10
15
22
2016-11-15T08:51:36Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
if (codetext.indexOf('top_module') < 0)
if (!confirm ("Warning: Top-level module must be named top_module. Submit anyway?"))
success = false;
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">module top_module( );
endmodule
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Simulate">
<input name="sbnew" type="submit" value="Simulate in new window" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" </html>{{#if:{{{share|}}} | | style="display:none"}}<html> value="Share">
</form>
<div id="sharelink"></div>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Verilog source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload and simulate" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
if (pl.textContent.substring(0,6) == "module") {
text = pl.textContent;
} else {
text = text + pl.textContent;
}
}
if (text.length)
text = text + "\n\nendmodule\n";
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/verilog/verilog.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/share.php");
var data = new FormData();
data.append('vlgcode_box', editor.getValue());
xhr.responseType = "text";
xhr.onload = function() {
var label = document.getElementById('sharelink');
var f = "http://" + "</html>{{SERVERNAME}}{{ARTICLEPATH}}<html>".replace("$1","</html>{{FULLPAGENAMEE}}<html>" + "?load=" + xhr.response.trim());
label.innerHTML="Your code is shared: <a href=\"" + f + "\">" + f + "</a>";
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
b0e4c33dde2180a2ec8c0165f3f9d88899bd99de
23
22
2016-11-24T05:52:35Z
Henry
1
1 revision imported
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
if (codetext.indexOf('top_module') < 0)
if (!confirm ("Warning: Top-level module must be named top_module. Submit anyway?"))
success = false;
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">module top_module( );
endmodule
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Simulate">
<input name="sbnew" type="submit" value="Simulate in new window" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" </html>{{#if:{{{share|}}} | | style="display:none"}}<html> value="Share">
</form>
<div id="sharelink"></div>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Verilog source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload and simulate" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
if (pl.textContent.substring(0,6) == "module") {
text = pl.textContent;
} else {
text = text + pl.textContent;
}
}
if (text.length)
text = text + "\n\nendmodule\n";
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/verilog/verilog.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/share.php");
var data = new FormData();
data.append('vlgcode_box', editor.getValue());
xhr.responseType = "text";
xhr.onload = function() {
var label = document.getElementById('sharelink');
var f = "http://" + "</html>{{SERVERNAME}}{{ARTICLEPATH}}<html>".replace("$1","</html>{{FULLPAGENAMEE}}<html>" + "?load=" + xhr.response.trim());
label.innerHTML="Your code is shared: <a href=\"" + f + "\">" + f + "</a>";
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
b0e4c33dde2180a2ec8c0165f3f9d88899bd99de
25
23
2016-11-24T10:40:53Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global _start
_start:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Simulate">
<input name="sbnew" type="submit" value="Simulate in new window" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" </html>{{#if:{{{share|}}} | | style="display:none"}}<html> value="Share">
</form>
<div id="sharelink"></div>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Verilog source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload and simulate" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/verilog/verilog.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/share.php");
var data = new FormData();
data.append('vlgcode_box', editor.getValue());
xhr.responseType = "text";
xhr.onload = function() {
var label = document.getElementById('sharelink');
var f = "http://" + "</html>{{SERVERNAME}}{{ARTICLEPATH}}<html>".replace("$1","</html>{{FULLPAGENAMEE}}<html>" + "?load=" + xhr.response.trim());
label.innerHTML="Your code is shared: <a href=\"" + f + "\">" + f + "</a>";
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
db3dcdec9e1a24a63a2fe4a09f0821f4317423d2
28
25
2016-11-24T10:46:33Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global _start
_start:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Simulate">
<input name="sbnew" type="submit" value="Simulate in new window" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" </html>{{#if:{{{share|}}} | | style="display:none"}}<html> value="Share">
</form>
<div id="sharelink"></div>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload and simulate" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/share.php");
var data = new FormData();
data.append('vlgcode_box', editor.getValue());
xhr.responseType = "text";
xhr.onload = function() {
var label = document.getElementById('sharelink');
var f = "http://" + "</html>{{SERVERNAME}}{{ARTICLEPATH}}<html>".replace("$1","</html>{{FULLPAGENAMEE}}<html>" + "?load=" + xhr.response.trim());
label.innerHTML="Your code is shared: <a href=\"" + f + "\">" + f + "</a>";
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
793d8bfcab3fb597e7061d3133c8033412cc0258
37
28
2016-11-24T11:14:03Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global _start
_start:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" </html>{{#if:{{{share|}}} | | style="display:none"}}<html> value="Share">
</form>
<div id="sharelink"></div>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload and simulate" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/share.php");
var data = new FormData();
data.append('vlgcode_box', editor.getValue());
xhr.responseType = "text";
xhr.onload = function() {
var label = document.getElementById('sharelink');
var f = "http://" + "</html>{{SERVERNAME}}{{ARTICLEPATH}}<html>".replace("$1","</html>{{FULLPAGENAMEE}}<html>" + "?load=" + xhr.response.trim());
label.innerHTML="Your code is shared: <a href=\"" + f + "\">" + f + "</a>";
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
f881c77a7d4c215e98ffed12af056990c898734b
38
37
2016-11-24T11:14:18Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global _start
_start:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" </html>{{#if:{{{share|}}} | | style="display:none"}}<html> value="Share">
</form>
<div id="sharelink"></div>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "/share.php");
var data = new FormData();
data.append('vlgcode_box', editor.getValue());
xhr.responseType = "text";
xhr.onload = function() {
var label = document.getElementById('sharelink');
var f = "http://" + "</html>{{SERVERNAME}}{{ARTICLEPATH}}<html>".replace("$1","</html>{{FULLPAGENAMEE}}<html>" + "?load=" + xhr.response.trim());
label.innerHTML="Your code is shared: <a href=\"" + f + "\">" + f + "</a>";
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
1ca60b6411f892207f4d530026470540c9fc152e
39
38
2016-11-25T08:05:14Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global _start
_start:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=arm_gen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
6a4e36ae744e4bd1f756804f9bfa36118ee1fdd9
40
39
2016-11-25T08:06:19Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global _start
_start:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
fed3eb4bc17a77ca5e1beb110704d53f5a8cfc7e
42
40
2016-11-25T08:36:40Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
pl = pl.nextElementSibling;
if (pl.textContent.length != 0) {
text = text + pl.textContent;
}
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
e89cd118660f4dcbeba99dc6f9d4623458d5b465
50
42
2016-11-26T02:31:26Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
79e23419d9b0eb1c88ffadfa2ade5ca070dac051
Main Page
0
1
1
2016-11-23T10:23:56Z
MediaWiki default
0
wikitext
text/x-wiki
<strong>MediaWiki has been installed.</strong>
Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.
== Getting started ==
* [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list]
* [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ]
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list]
* [//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language]
* [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Learn how to combat spam on your wiki]
71692120f6b6a147f9d3ce9d8e7cafc7e797f8c5
HDLBits:LoginPage
3072
2
2
2016-11-23T10:28:03Z
Henry
1
Created page with "<html> <style> div#hloginbox td#hcuser { text-align: center; padding: 1.5em; font-weight: bold;} </style> <div id="hloginbox" class="htableform"> <form method="post"><table><..."
wikitext
text/x-wiki
<html>
<style>
div#hloginbox td#hcuser { text-align: center; padding: 1.5em; font-weight: bold;}
</style>
<div id="hloginbox" class="htableform">
<form method="post"><table></html>{{#if:{{{user|}}}|<html><tr><td id="hcuser">Logged in as </html>{{{user}}}<html>.</td></tr><tr><td style="text-align: right;"></html>[[Special:VlgProfile|Profile settings...]]<html><input type="submit" name="logout" value="Logout"></td></tr></html>|<html>
<tr><td>Username:</td><td><input type="text" name="vlg_username"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password"></td></tr>
<tr><td></td><td style="text-align: right;"></html>[[Special:VlgProfile|Create profile...]]<html><input type="submit" name="login" value="Login"></td></tr></html>}}{{#if:{{{msg|}}}|<html><tr><td colspan=2><b></html>{{{msg}}}<html></b></td></tr></html>|}}<html></table></form></div>
</html>
<noinclude>
This page belongs to the namespace {{NAMESPACE}}. It is used to show the user the HDLBits login and log out pages.
Parameters:
; user: If set, this is the currently logged-in user. The logout page should be shown. If not set, show the login page.
; msg : An extra message to be displayed, such as "Invalid login or password"
</noinclude>
e172bbe8c206a78d27dd32f2ee3aab6c61ab6197
MediaWiki:Common.css
8
3
3
2016-11-23T10:28:47Z
Henry
1
Created page with "/* CSS placed here will be applied to all skins */ div#p-personal { display: none; } /* HDLBits stuff */ div.hb-box { padding: 1ex 1em; border: 1px #999 solid;..."
css
text/css
/* CSS placed here will be applied to all skins */
div#p-personal { display: none; }
/* HDLBits stuff */
div.hb-box {
padding: 1ex 1em;
border: 1px #999 solid;
margin: 10px 0px 10px 0px;
}
div#submitbox {
background-color: #fff8e8;
}
div#hintbox {
background-color: #f4f8ff;
}
div#hintbox button {
display:inline;
background-color: transparent;
cursor: pointer;
border:0;
outline: none;
padding:0;
margin-left: -20px; padding-left: 20px;
margin-top: -1ex; padding-top: 1ex;
margin-bottom: 0; padding-bottom: 1ex;
color:#00f; width: 100%; text-align: left;
text-decoration:underline;
font-weight: normal;
}
div#portlistouterbox {
background-color: #f9f9f9;
}
pre#portlistbox{ /* This is the pre inside */
border: 0;
background-color: transparent;
padding:0px 0px 0px 1em;
margin: 0 0 1ex 0;
}
div.hb-subbox input[type=submit], div.hb-subbox input[type=button].submit{
margin-top: 1ex;
padding: 1ex 1em;
}
div.hb-subbox input[type=file] {
width: 22em;
}
0ebeccb705b7fe80c2a3290e6e472b1080cdc87a
MediaWiki:Sidebar
8
4
4
2016-11-23T10:31:18Z
Henry
1
Created page with "* Problem Set ** Problem sets|Browse Problem Set ** Special:VlgStats|Problem Set Stats ** Special:VlgRank|User Rank List * Simulation ** http://nios.stuffedcow.net/|Run a Simu..."
wikitext
text/x-wiki
* Problem Set
** Problem sets|Browse Problem Set
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** http://nios.stuffedcow.net/|Run a Simulation (Nios II)
** http://nios.stuffedcow.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Step_one|Getting Started
** Project:About|About HDLBits
** Special:Contact/feedback|Bugs and Suggestions
* SEARCH
* TOOLBOX
* LANGUAGES
f1699d5376166d7f2bf2a3a9860494aa64eb844c
35
4
2016-11-24T11:10:58Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** http://nios.stuffedcow.net/|Run a Simulation (Nios II)
** http://nios.stuffedcow.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Step_one|Getting Started
** Project:About|About HDLBits
** Special:Contact/feedback|Bugs and Suggestions
* SEARCH
* TOOLBOX
* LANGUAGES
44e618533e7532c66bb8736408a4ce2ab5dd6230
36
35
2016-11-24T11:12:33Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** http://nios.stuffedcow.net/|Run a Simulation (Nios II)
** http://nios.stuffedcow.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Step_one|Getting Started
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* SEARCH
* TOOLBOX
* LANGUAGES
d3ab23e67ed2a4ea16f5952a64202e10c6484804
MediaWiki:Foreground.css
8
5
5
2016-11-23T10:32:08Z
Henry
1
Created page with "/* @import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700'; Font loading moved to LocalSettings.php */ body { font-family..."
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 1px 0px 6px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
09b3c32b3133e190a4a7e1af00bd9c93d62f0804
MediaWiki:Contactpage-pagetext-feedback
8
6
6
2016-11-23T10:34:11Z
Henry
1
Created page with "Use this form if you have a suggestion, feedback on the problem set or one particular problem, or a bug to report. * Is there a bug on one of the problems? Is the problem text..."
wikitext
text/x-wiki
Use this form if you have a suggestion, feedback on the problem set or one particular problem, or a bug to report.
* Is there a bug on one of the problems? Is the problem text unclear or ambiguous?
* Bugs on the site or in the auto-tester?
* Suggestions for what subject areas new problems should focus on?
* Suggestions for improving the style of problem texts, or interesting ways to use an auto-tester?
* Feature requests?
* Comments?
9f630707023ae121c5ede2fd68b18adf78057c61
MediaWiki:Contactpage-subject-feedback
8
7
7
2016-11-23T10:34:39Z
Henry
1
Created page with "Feedback/Suggestion/Bug report"
wikitext
text/x-wiki
Feedback/Suggestion/Bug report
fac87816fe49687de8576bba8610fb698198e4e0
Arm/return123
0
16
24
2016-11-24T10:38:09Z
Henry
1
Created page with "Write a function named <tt>_start</tt> that returns 123. This implies two things: * The return value (in r0) is 123 * Your function returns to the caller (The return address i..."
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
{{PortlistBox|.global _start
_start: }}
{{SubmitBox}}
de87c9a7e5528adb2a25d20de4bd935de372fadf
27
24
2016-11-24T10:43:00Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
{{PortlistBox|.global _start
_start:
}}
{{SubmitBox}}
583f35133069f5476fd0998a41e852ae305dea70
43
27
2016-11-25T08:36:58Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
{{SubmitBox}}
9ef0edc1d1d01132b42cfa00ca61fce424411469
Nios/return123
0
17
29
2016-11-24T10:49:36Z
Henry
1
Created page with "Write a function named <tt>_start</tt> that returns 123. This implies two things: * The return value (in r2) is 123 * Your function returns to the caller (The return address i..."
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r2) is 123
* Your function returns to the caller (The return address is <tt>ra</tt>)
{{PortlistBox|.global _start
_start:
}}
{{SubmitBox|arch=nios2}}
faeb3b363178ab9a005d77d6577ecf1c56c9ea7a
41
29
2016-11-25T08:11:59Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r2) is 123
* Your function returns to the caller (The return address is <tt>ra</tt>)
{{SubmitBox|arch=nios2}}
fa842c430171303c6622f89da49f647a37063856
Nios index
0
18
30
2016-11-24T11:08:27Z
Henry
1
Created page with "*<vlgstat tc="return123n">Return 123</vlgstat>"
wikitext
text/x-wiki
*<vlgstat tc="return123n">Return 123</vlgstat>
7d80189793efe172f85005f86e0ea5e36fc06e87
Arm index
0
19
31
2016-11-24T11:08:37Z
Henry
1
Created page with "*<vlgstat tc="return123">Return 123</vlgstat>"
wikitext
text/x-wiki
*<vlgstat tc="return123">Return 123</vlgstat>
ccb3f13013f72262e298d3c29c320a6725c5ab55
45
31
2016-11-25T23:55:50Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="return123">Return 123</vlgstat>
4d5a62a4d2d8ef23d73969c926c2cb9c02e73c00
Problem sets
0
20
32
2016-11-24T11:08:54Z
Henry
1
Created page with "<vlgstat action="genorder"/><!-- vlgstat action=genorder must occur before any vlgstat tc tags. It instructs the extension to clear the DB table and then record each instance..."
wikitext
text/x-wiki
<vlgstat action="genorder"/><!-- vlgstat action=genorder must occur before any vlgstat tc tags. It instructs the extension to clear the DB table and then record each instance of vlgstat tc into the table, to generate an ordered list of testcases. Caution: Potential abuse if action=genorder is used on any other page. -->
== Nios II ==
{{Nios_Index}}
== ARMv7 ==
{{Arm_Index}}
32a4cace49431702f3e29aca347856f9effd411f
33
32
2016-11-24T11:09:14Z
Henry
1
wikitext
text/x-wiki
<vlgstat action="genorder"/><!-- vlgstat action=genorder must occur before any vlgstat tc tags. It instructs the extension to clear the DB table and then record each instance of vlgstat tc into the table, to generate an ordered list of testcases. Caution: Potential abuse if action=genorder is used on any other page. -->
== Nios II ==
{{:Nios_Index}}
== ARMv7 ==
{{:Arm_Index}}
cf08c811f06d0d803a9c5b8c5fc0de89a1719dc8
34
33
2016-11-24T11:09:28Z
Henry
1
wikitext
text/x-wiki
<vlgstat action="genorder"/><!-- vlgstat action=genorder must occur before any vlgstat tc tags. It instructs the extension to clear the DB table and then record each instance of vlgstat tc into the table, to generate an ordered list of testcases. Caution: Potential abuse if action=genorder is used on any other page. -->
== Nios II ==
{{:Nios_index}}
== ARMv7 ==
{{:Arm_index}}
2e49fcbce75e1e7aadd7c5ce1849a56d2f79b065
Arm/strlen
0
21
44
2016-11-25T23:55:17Z
Henry
1
Created page with "Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argume..."
wikitext
text/x-wiki
Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0. The string must not be modified.
Return (in <tt>r0</tt>) the length of the string, which excludes the null termination character;
<syntaxhighlight lang="c">unsigned int strlen(const char *string);</syntaxhighlight>
Example input:
"Hello world"
Example output:
r0 = 11
{{SubmitBox|arch=arm|entry=strlen}}
d31371f0a4726ee39c4e7eca6f34cf9a01286c23
49
44
2016-11-26T02:30:58Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0. The string must not be modified.
Return (in <tt>r0</tt>) the length of the string, which excludes the null termination character;
<syntaxhighlight lang="c">unsigned int strlen(const char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|11|3=
.global _start
MyString: .string "Hello World"
_start:
ldr r0, =MyString
bl strlen
1: b 1b
.global strlen
strlen:}}
{{SubmitBox|arch=arm|entry=strlen}}
b2bf9ba6855e2af9c0f5ee06dd367a971306f9d9
Template:ExampleBox
10
22
47
2016-11-26T02:23:50Z
Henry
1
Created page with "{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len..."
wikitext
text/x-wiki
{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} {{#ifeq: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} | 1 | line | lines}}.''</p>|}}<div id="portlistouterbox" class="hb-box"><html><h4>Sample Input</h4></html>
<pre<includeonly></includeonly> >{{{1}}}</pre><html><h4>Sample Output</h4></html><pre<includeonly></includeonly> >{{{2}}}</pre>
<pre<includeonly></includeonly> id="portlistbox" style="display:none;">{{{3|}}}</pre></div>
<noinclude>This template has four parameters:
*1: This is the sample input
*2: This is the sample output
*3: This is optional, and is the text for a <pre> that won't be displayed. The SubmitBox template will ''also'' append this parameter into its textarea. This is used to provide code sample/structure that won't be shown in the PortlistBox. It seems like leading whitespace is trimmed, so start this with a // comment.
* len : If defined, this emits a "Expected solution length" line immediately before the PortlistBox.
</noinclude>
bfccab04d2078dc3e4f0a910d98a32e6f3786482
48
47
2016-11-26T02:29:31Z
Henry
1
wikitext
text/x-wiki
{{#if: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} |''<p style="margin-top:1.4em;"><b>Expected solution length:</b> Around {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} {{#ifeq: {{{len|{{#vlgtc:{{lcfirst:{{PAGENAMEE}}}}|len}}}}} | 1 | line | lines}}.''</p>|}}<div id="portlistouterbox" class="hb-box"><html><h4>Sample Input</h4></html>
<pre<includeonly></includeonly> >{{{1}}}</pre><html><h4>Sample Output</h4></html><pre<includeonly></includeonly> >{{{2}}}</pre>
<pre<includeonly></includeonly> id="portlistbox" style="display:none;">{{{3|}}}</pre></div>
<noinclude>This template has four parameters:
*1: This is the sample input
*2: This is the sample output
*3: This is optional, and is the text for a <pre> that won't be displayed, but has id="portlistbox". The SubmitBox template will append this parameter into its textarea. This is used to pre-load a code sample into the editor. Leading whitespace is trimmed.
* len : If defined, this emits a "Expected solution length" line immediately before the ExampleBox.
</noinclude>
96153c3115a9ad1372ca81080e5b8ceee2b61d11
Arm/strlen
0
21
51
49
2016-11-26T02:32:58Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0. The string must not be modified.
Return (in <tt>r0</tt>) the length of the string, which excludes the null termination character;
<syntaxhighlight lang="c">unsigned int strlen(const char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|11|3=
.data
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strlen
1: b 1b
.global strlen
strlen:}}
{{SubmitBox|arch=arm|entry=strlen}}
97e0e27979e67edbc2ad7548c98d84e81ce67001
53
51
2016-11-26T02:35:20Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0. The string must not be modified.
Return (in <tt>r0</tt>) the length of the string, which excludes the null termination character;
<syntaxhighlight lang="c">unsigned int strlen (const char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|11|3=
.data
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strlen
1: b 1b
.global strlen
strlen:}}
{{SubmitBox|arch=arm|entry=strlen}}
27345399cd4f96b5f6135acff15adbe87bdedbe0
Template:SubmitBox
10
15
52
50
2016-11-26T02:33:37Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
150e0dda3efc6f0678a51eb017a555c6598bbd35
Arm/abs
0
23
54
2016-11-26T02:38:43Z
Henry
1
Created page with "Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer. <syntaxhighlight lang="c">int abs (int n);</syntaxhighl..."
wikitext
text/x-wiki
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
<syntaxhighlight lang="c">int abs (int n);</syntaxhighlight>
{{ExampleBox|10
-10|10
10|3=
.global _start
_start:
movi r0, 10
bl abs
1: b 1b // Done
.global abs
abs:}}
{{SubmitBox|arch=arm}}
d46e91952543c4a48cb93957f71114394d8c171f
55
54
2016-11-26T02:39:33Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
<syntaxhighlight lang="c">int abs (int n);</syntaxhighlight>
{{ExampleBox|10
-10|10
10|3=
.global _start
_start:
mov r0, #10
bl abs
1: b 1b // Done
.global abs
abs:}}
{{SubmitBox|arch=arm}}
8e89df822cf0364c4d98619f5e994b431a73c578
Arm index
0
19
56
45
2016-11-26T02:47:27Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
d3822f155ac55d779cca1cc668f62b30b301d712
61
56
2016-11-26T03:13:16Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
efa1b545b8d6c9ded09c4403ffc8c22bf5775e23
65
61
2016-11-26T03:42:10Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
961bd6e4c3170ac8d77d65c5d9a8608631f0735d
67
65
2016-11-26T04:39:30Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
0efba2811450063bf3f64ac5cf9ed7c8fd864bb1
69
67
2016-11-26T04:56:40Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
50a0846e3e1a66b8bfc9c668b9a2198f7a5fab24
71
69
2016-11-26T05:48:16Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
966cea1ce5ff8135183d246202ecf95deaa47105
73
71
2016-11-26T06:01:24Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
4213511f553d043dad8d73f207aa7583be70bdd6
75
73
2016-11-26T07:04:44Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
0cb118793ea132d73129df179c49b082d5f86c5b
77
75
2016-11-26T07:34:20Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
e1e60fa96cf98e14e41ef590af8ea558380047c1
79
77
2016-11-26T08:48:59Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
9f8de367624c35653b93cca90c8d8d53de0be439
83
79
2016-11-26T11:11:43Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
b8ec96f48c7b6596a66b2d17b87fe000b22ea1c3
85
83
2016-11-26T19:57:18Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
58bb37e0ecccbc37d2cffd676e6b58bfe2bd43c0
90
85
2016-11-27T00:16:04Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
f545b074f100b8babf93916ae762f84c9552e044
94
90
2016-11-27T06:49:56Z
Henry
1
wikitext
text/x-wiki
=== Arithmetic ===
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
dcc004a90d21a38865228a36f416168ac82f3259
95
94
2016-11-27T06:51:18Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Arithmetic ===
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
5c3a14b42b469c2338b06c7f11d041436692cb88
Arm/return123
0
16
57
43
2016-11-26T02:48:17Z
Henry
1
Henry moved page [[Return123]] to [[Arm/return123]]
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
{{SubmitBox}}
9ef0edc1d1d01132b42cfa00ca61fce424411469
59
57
2016-11-26T02:49:24Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
{{ExampleBox| | 123}}
{{SubmitBox|arch=arm}}
d5674da27ee89d68f45f085fa4eb7f538601d56a
Return123
0
24
58
2016-11-26T02:48:17Z
Henry
1
Henry moved page [[Return123]] to [[Arm/return123]]
wikitext
text/x-wiki
#REDIRECT [[Arm/return123]]
7b245612fa2d4a3faba7603afa476fbf7691e95d
Arm/odd
0
25
60
2016-11-26T02:56:07Z
Henry
1
Created page with "Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even <syntaxhighlight lang="c">int odd (int n);</syntaxhighlight> {{ExampleBox|1 2|1 0|..."
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
mov r0, #1
bl odd
1: b 1b // Done
.global odd
odd:}}
{{SubmitBox|arch=arm}}
1ceeab2de0f6033afdadf8736aede28701c0944b
Nios index
0
18
62
30
2016-11-26T03:14:38Z
Henry
1
wikitext
text/x-wiki
*<vlgstat tc="nios/return123">Return 123</vlgstat>
9aec6689361ddf7c72487d7c9524c8dbdbd15c1f
96
62
2016-11-27T06:51:50Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
51c066786f11f2da0bd190b8fb08f955ec8df346
Arm/array inc
0
26
63
2016-11-26T03:32:39Z
Henry
1
Created page with "Write a function that increments (by 1) each element in an array of integers. The first argument is a pointer to the start of the array. The second argument is the number of e..."
wikitext
text/x-wiki
Write a function that increments (by 1) each element in an array of integers. The first argument is a pointer to the start of the array. The second argument is the number of elements in the array.
There is no return value.
<syntaxhighlight lang="c">void array_inc (int *array, unsigned int n);</syntaxhighlight>
{{ExampleBox|[1 2 3 4]|[2 3 4 5] |3=
.data
Array: .word 1, 2, 3, 4
.text
.global _start
_start:
ldr r0, =Array
movi r1, #4
bl array_inc
1: b 1b // Done
.global array_inc
array_inc:}}
{{SubmitBox|arch=arm}}
e95449ea8e997e9dcd3e2decd9d8f12e676277b6
64
63
2016-11-26T03:32:51Z
Henry
1
wikitext
text/x-wiki
Write a function that increments (by 1) each element in an array of integers. The first argument is a pointer to the start of the array. The second argument is the number of elements in the array.
There is no return value.
<syntaxhighlight lang="c">void array_inc (int *array, unsigned int n);</syntaxhighlight>
{{ExampleBox|[1 2 3 4]|[2 3 4 5] |3=
.data
Array: .word 1, 2, 3, 4
.text
.global _start
_start:
ldr r0, =Array
mov r1, #4
bl array_inc
1: b 1b // Done
.global array_inc
array_inc:}}
{{SubmitBox|arch=arm}}
d6f839acd36b87138c67ac8c59e1a385aa959a3d
Arm/invert
0
27
66
2016-11-26T04:39:13Z
Henry
1
Created page with "Write a function that returns the bitwise inversion of its parameter. <syntaxhighlight lang="c">int invert (int n);</syntaxhighlight> {{ExampleBox|1|0xfffffffe|3= .global _s..."
wikitext
text/x-wiki
Write a function that returns the bitwise inversion of its parameter.
<syntaxhighlight lang="c">int invert (int n);</syntaxhighlight>
{{ExampleBox|1|0xfffffffe|3=
.global _start
_start:
mov r0, #1
bl invert
1: b 1b // Done
.global invert
invert:}}
{{SubmitBox|arch=arm}}
6e5d232963c6873ba386b573c81c4b65794e5756
Arm/add64
0
28
68
2016-11-26T04:56:17Z
Henry
1
Created page with "Write a function that returns the sum of its two parameters. The parameters and return values are both 64-bit integers. 64-bit operands are passed in two consecutive registers..."
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 64-bit integers. 64-bit operands are passed in two consecutive registers. Thus, the first parameter is in <tt>r0</tt> and <tt>r1</tt>, while the second parameter is in <tt>r2</tt> and <tt>r3</tt>, with the return value returned in <tt>r0</tt> and <tt>r1</tt>.
<syntaxhighlight lang="c">long long add64 (long long a, long long b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
mov r0, #1 // Lower 32 bits of a
mov r1, #0 // Upper 32 bits of a
mov r2, #1 // Lower 32 bits of b
mov r3, #0 // Upper 32-bits of b
bl add64
1: b 1b // Done
.global add64
add64:}}
{{SubmitBox|arch=arm}}
e15ff71d8c2791fb31c47b3408df8f20caef9edd
Arm/popcount
0
29
70
2016-11-26T05:47:38Z
Henry
1
Created page with "Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]). <syntaxhighlight..."
wikitext
text/x-wiki
Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]).
<syntaxhighlight lang="c">int popcount (int n);</syntaxhighlight>
{{ExampleBox|5
255|2
8|3=
.global _start
_start:
mov r0, #5
bl popcount
1: b 1b // Done
.global popcount
popcount:}}
{{SubmitBox|arch=arm}}
a76b267876da1047530d744ac18fe5c2de562424
Arm/load
0
30
72
2016-11-26T06:00:58Z
Henry
1
Created page with "There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. <syntaxhighlight lang="c">int load ();..."
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=[0x345678] = 123
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
str r1, [r0]
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
e3c8c70b666be22e1e65d2eb69a1863dd35a17b5
Arm/load align
0
31
74
2016-11-26T07:03:40Z
Henry
1
Created page with "Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. Note that this pointer is not nece..."
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your routine must only do properly aligned accesses.
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
aedb1016680d96b04bd20776478ff75368fd860a
Arm/increment align
0
32
76
2016-11-26T07:33:49Z
Henry
1
Created page with "Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. Note that this pointer is not necess..."
wikitext
text/x-wiki
Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your routine must only do properly aligned accesses.
<syntaxhighlight lang="c">void inc (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|(memory changed to 0x1235)|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl inc
1: b 1b // Done
.global inc
inc:}}
{{SubmitBox|arch=arm}}
170fb7f9ad9c3333e92e246a9eb8bc685a1c1952
Arm/memmove
0
33
78
2016-11-26T08:07:20Z
Henry
1
Created page with "Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still wor..."
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still work correctly (contrast <tt>memmove</tt> with <tt>memcpy</tt>). The source and destination are byte-aligned, and length can be any number of bytes.
You may assume the source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source and source+length <= 4GB).
<syntaxhighlight lang="c">void memmove (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
ldr r0, =Dest
ldr r1, =Src
ldr r2, =16
bl memmove
1: b 1b // Done
.global memmove
memmove:}}
{{SubmitBox|arch=arm}}
915c25403195c122c8a8bb115672052181475d41
Nios/return123
0
17
80
41
2016-11-26T09:26:54Z
Henry
1
Henry moved page [[Return123n]] to [[Nios/return123]]
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r2) is 123
* Your function returns to the caller (The return address is <tt>ra</tt>)
{{SubmitBox|arch=nios2}}
fa842c430171303c6622f89da49f647a37063856
92
80
2016-11-27T00:18:43Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r2) is 123
* Your function returns to the caller (The return address is <tt>ra</tt>)
{{ExampleBox| | 123}}
{{SubmitBox|arch=nios2}}
da31c2d92ba3c2377c695613cc2b3efbae0e33ad
Return123n
0
34
81
2016-11-26T09:26:55Z
Henry
1
Henry moved page [[Return123n]] to [[Nios/return123]]
wikitext
text/x-wiki
#REDIRECT [[Nios/return123]]
9f7eb83d8d953c9b99be9f79856c6ef15a5b365c
Arm/strtolower
0
35
82
2016-11-26T11:10:44Z
Henry
1
Created page with "Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as th..."
wikitext
text/x-wiki
Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0.
Upper-case characters are defined as those with value between 'A' (0x41) and 'Z' (0x5a), inclusive.
There is no return value.
<syntaxhighlight lang="c">void strtolower (char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|"hello world"|3=
.data
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strtolower
1: b 1b
.global strtolower
strtolower:}}
{{SubmitBox|arch=arm}}
39cf5dca7c26141f89c28e7102edc7019a051044
Arm/linklist len
0
36
84
2016-11-26T19:39:02Z
Henry
1
Created page with "In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with val..."
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will find the length of the linked list beginning at the node passed to the function as the first argument. A null pointer should return length 0. Do not attempt to detect cycles in the linked list (Cycles should cause your function to run forever.)
<syntaxhighlight lang="c">
struct node { node *next; };
unsigned int listlen(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> null | 2=3 | 3=
.data
A: .word B
B: .word C
C: .word 0
.text
.global _start
ldr r0, =A
bl listlen
.global listlen
listlen: }}
{{SubmitBox|arch=arm}}
da94213bc8ecfa2477cf996ab653c3744451cb97
91
84
2016-11-27T00:16:45Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will find the length of the linked list beginning at the node passed to the function as the first argument. A null pointer should return length 0. Do not attempt to detect cycles in the linked list (Cycles should cause your function to run forever.)
<syntaxhighlight lang="c">
struct node { node *next; };
unsigned int listlen(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> null | 2=3 | 3=
.data
A: .word B
B: .word C
C: .word 0
.text
.global _start
ldr r0, =A
bl listlen
1: br 1b // done
.global listlen
listlen: }}
{{SubmitBox|arch=arm}}
6ac875ffe52cf096b767941598fb664f62e0d9b1
Arm/linklist del
0
37
86
2016-11-26T23:35:52Z
Henry
1
Created page with "In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with val..."
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> null
listdel(A) | 2=A -> C -> null
returns B | 3=
.data
A: .word B
B: .word C
C: .word 0
.text
.global _start
ldr r0, =A
bl listdel
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
8f9b7aea76d68baa6ed122b9f66aa8736bce6073
87
86
2016-11-26T23:49:41Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
B: .word C
C: .word D
D: .word 0
.text
.global _start
ldr r0, =A
bl listdel
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
f8d258fba1e55aa12d62363135db6ba9f73894d1
88
87
2016-11-27T00:10:08Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node passed to <tt>listdel</tt> is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
B: .word C
C: .word D
D: .word 0
.text
.global _start
ldr r0, =A
bl listdel
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
844ecc71fb2784a045cf18d9cc3257cf80d47aed
89
88
2016-11-27T00:15:35Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node passed to <tt>listdel</tt> is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
B: .word C
C: .word D
D: .word 0
.text
.global _start
ldr r0, =A
bl listdel
1: br 1b // done
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
7c342d48a367c84b6b08b62d1bf5226d11ca3772
Main Page
0
1
93
1
2016-11-27T05:57:52Z
Henry
1
wikitext
text/x-wiki
__NOTOC__
{{NoTitle}}
== ASMBits — Assembly Language Practice ==
ASMBits is a collection of small assembly language programming exercises. There are currently exercises for ARMv7 and Nios II architectures.
Each problem requires you to write a function in assembly language.
ASMBits runs your code with a few test input cases, and the results are compared to those produced by our reference solution.
=== How to use ASMBits ===
# Choose a problem: Choose either [[Arm_index|'''ARMv7''']] or [[Nios_index|'''Nios II''']].
# Write a solution and debug it.
# Submit.
If you want to [[Special:VlgStats/Me|'''track your progress''']] or move to another browser, [[Special:VlgProfile|'''create a username and password''']] so you can [[Special:VlgLogin|'''log in''']] from elsewhere.
a1a40071961950cd7aeedf8e535ceb230f3b8b4f
Arm/hailstone
0
38
97
2016-11-27T08:01:55Z
Henry
1
Created page with "A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule: * If n is ev..."
wikitext
text/x-wiki
A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule:
* If n is even, n = n / 2
* If n is odd, n = 3n + 1
It has been conjectured that the sequence always reaches 1 for any starting positive integer after some number of steps. Write a function to compute the number of steps required for a given starting number to reach 1. The starting number is a non-zero unsigned integer. You may assume that the sequences tested will not overflow a 32-bit unsigned integer.
<syntaxhighlight lang="c">unsigned int hailstone (unsigned int n);</syntaxhighlight>
{{ExampleBox|5|5|3=
.global _start
_start:
mov r0, #5
bl hailstone
1: b 1b // Done
.global hailstone
hailstone:}}
{{SubmitBox|arch=arm}}
ef50be9da8ebbbf1df48516ea4fa7768ce8f920e
98
97
2016-11-27T08:03:14Z
Henry
1
wikitext
text/x-wiki
A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule:
* If n is even, n ⇐ n / 2
* If n is odd, n ⇐ 3n + 1
It has been conjectured that the sequence always reaches 1 for any starting positive integer after some number of steps. Write a function to compute the number of steps required for a given starting number to reach 1. The starting number is a non-zero unsigned integer. You may assume that the sequences tested will not overflow a 32-bit unsigned integer.
<syntaxhighlight lang="c">unsigned int hailstone (unsigned int n);</syntaxhighlight>
{{ExampleBox|5|5|3=
.global _start
_start:
mov r0, #5
bl hailstone
1: b 1b // Done
.global hailstone
hailstone:}}
{{SubmitBox|arch=arm}}
b23307a9705f55cc9cfc106df50a266984664407
99
98
2016-11-27T08:04:14Z
Henry
1
wikitext
text/x-wiki
A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule:
* If n is even, n ⇐ n / 2
* If n is odd, n ⇐ 3n + 1
It has been conjectured that the sequence always reaches 1 for any starting positive integer after some number of steps. Write a function to compute the number of steps required for a given starting number to reach 1. The starting number is a non-zero unsigned integer. You may assume that the sequences tested will not overflow a 32-bit unsigned integer.
<syntaxhighlight lang="c">unsigned int hailstone (unsigned int n);</syntaxhighlight>
{{ExampleBox|5|5
(The sequence is 5, 16, 8, 4, 2, 1)|3=
.global _start
_start:
mov r0, #5
bl hailstone
1: b 1b // Done
.global hailstone
hailstone:}}
{{SubmitBox|arch=arm}}
491f8fb573b52181f87c69993bb52dc44b22c43b
100
99
2016-11-27T08:04:23Z
Henry
1
wikitext
text/x-wiki
A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule:
* If n is even, n ⇐ n / 2
* If n is odd, n ⇐ 3n + 1
It has been conjectured that the sequence always reaches 1 for any starting positive integer after some number of steps. Write a function to compute the number of steps required for a given starting number to reach 1. The starting number is a non-zero unsigned integer. You may assume that the sequences tested will not overflow a 32-bit unsigned integer.
<syntaxhighlight lang="c">unsigned int hailstone (unsigned int n);</syntaxhighlight>
{{ExampleBox|5|5 (The sequence is 5, 16, 8, 4, 2, 1)|3=
.global _start
_start:
mov r0, #5
bl hailstone
1: b 1b // Done
.global hailstone
hailstone:}}
{{SubmitBox|arch=arm}}
6cabf5bad818c2fd924f30b0d166b1c48ac901a0
Arm index
0
19
101
95
2016-11-27T08:06:22Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Arithmetic ===
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
f88005abd8a4d557a5cbdaa77236a1a3bd95134a
115
101
2016-11-27T09:31:36Z
Henry
1
/* Problem Set for ARMv7 */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Arithmetic ===
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
3535e89e468aa375a1596b5a07a387052030cc23
121
115
2016-11-27T10:30:54Z
Henry
1
/* Problem Set for ARMv7 */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Arithmetic ===
*<vlgstat tc="arm/return123">Return 123</vlgstat>
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
ba1d23b8f3bad9e58a54d62676a291abf4d908ca
128
121
2016-11-27T23:47:05Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
f1804d0de111483148e9fc5dd3770b2fbe071561
Template:SubmitBox
10
15
102
52
2016-11-27T08:11:47Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
a6f79078ec1980d9691e89c8a09f23d73b5542ec
103
102
2016-11-27T08:12:31Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
b1557e68a8cd75964c60a54c9f39ba97a8cb027a
104
103
2016-11-27T08:13:26Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="return pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
c16f6c1d808acaea35b1022bff693453757a30d8
105
104
2016-11-27T08:16:59Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); return true;">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
477aec69aa79398706504d2218059d98cae0809b
106
105
2016-11-27T08:18:24Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
c86179a45b82c0bd295c6d4c9d6aa5b035f42cb1
107
106
2016-11-27T08:19:45Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this);1">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
7daef70e1ccfb5c6c679e964dffa7ea4a7e3caa0
108
107
2016-11-27T08:23:59Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onsubmit="pause_btn(this);">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
6a6914754d37ed5d79327b013e99beee3fb27cee
109
108
2016-11-27T08:26:30Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onsubmit="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
540d71a8beba74a70414936ef98c8c197d15cc66
110
109
2016-11-27T08:27:01Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this);">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
bd85d7acbac9128836cb17790c6b94825a1c8e2d
111
110
2016-11-27T08:28:31Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); this.form.submit();">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : "");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
131ff1a4e1961536dd5aea00e86f789566aabb5b
Arm/func pack3
0
39
112
2016-11-27T08:52:48Z
Henry
1
Created page with "Write a function that stores three integers into consecutive words in memory. The function should write <tt>n1</tt>, <tt>n2</tt>, and <tt>n3</tt> (in that order, lowest to hig..."
wikitext
text/x-wiki
Write a function that stores three integers into consecutive words in memory. The function should write <tt>n1</tt>, <tt>n2</tt>, and <tt>n3</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>.
There is no return value.
<syntaxhighlight lang="c">void pack3 (int* array, int n1, int n2, int n3);</syntaxhighlight>
{{ExampleBox| 0x20000, 3, 4, 5 |
Writes 3 to [0x20000], 4 to [0x20004], and 5 to [0x20008] | 3=
.global _start
_start:
ldr r0, =0x20000
mov r1, #3
mov r2, #4
mov r3, #5
bl pack3
1: b 1b // done
.global pack3
pack3: }}
{{SubmitBox|arch=arm}}
b7f39423052c894af9d04a5de8262a67e6091b00
113
112
2016-11-27T08:56:44Z
Henry
1
wikitext
text/x-wiki
Write a function that stores three integers into consecutive words in memory. The function should write <tt>n1</tt>, <tt>n2</tt>, and <tt>n3</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. You may assume that <tt>array</tt> is properly aligned for words (4-byte aligned).
There is no return value.
<syntaxhighlight lang="c">void pack3 (int* array, int n1, int n2, int n3);</syntaxhighlight>
{{ExampleBox| 0x20000, 3, 4, 5 |
Writes 3 to [0x20000], 4 to [0x20004], and 5 to [0x20008] | 3=
.global _start
_start:
ldr r0, =0x20000
mov r1, #3
mov r2, #4
mov r3, #5
bl pack3
1: b 1b // done
.global pack3
pack3: }}
{{SubmitBox|arch=arm}}
e4cb53c0261fbd999e710465e542d037d223bbe3
Arm/func pack20
0
40
114
2016-11-27T09:31:03Z
Henry
1
Created page with "Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that o..."
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
{{ExampleBox| 0x20000, 3, 4, 5, 6, ... , 22 |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
d49cd626f7967daf1ffb32f9246c036d7ef3575a
140
114
2016-11-29T11:54:26Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
{{ExampleBox| pack20 (0x20000, 3, 4, 5, 6, ... , 22); |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
7011983a3ad14ff9cbdd5e57e5c79686d27c5be2
141
140
2016-11-29T11:54:47Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
2913443effc6c575acab4936b297b157c3b3d1d7
Arm/sum args
0
41
116
2016-11-27T09:54:30Z
Henry
1
Created page with "Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to sum. The remaini..."
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to sum. The remaining <tt>n</tt> integers are the numbers to sum. The function will be called with exactly <tt>n+1</tt> arguments.
Return the sum of all <tt>n</tt> numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
<syntaxhighlight lang="c">int sum(int n, ... );</syntaxhighlight>
{{ExampleBox|sum(2, 1, 2)| 3 | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial sp
mov r0, #2
mov r1, #1
mov r2, #2
bl sum
.global sum
sum: }}
{{SubmitBox|arch=arm}}
7751f7808f76ba29f0bdfd337cd98f56270cbeb1
117
116
2016-11-27T10:09:09Z
Henry
1
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to sum. The remaining <tt>n</tt> integers are the numbers to sum. The function will be called with exactly <tt>n+1</tt> arguments.
Return the sum of all <tt>n</tt> numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
<syntaxhighlight lang="c">int sum (int n, ... );</syntaxhighlight>
{{ExampleBox|sum(2, 1, 2)| 3 | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial sp
mov r0, #2
mov r1, #1
mov r2, #2
bl sum
.global sum
sum: }}
{{SubmitBox|arch=arm}}
6724a4739659d3b0096af2a2be20ca4e6cd31b63
119
117
2016-11-27T10:19:07Z
Henry
1
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to sum. The remaining <tt>n</tt> integers are the numbers to sum. The function will be called with exactly <tt>n+1</tt> arguments.
Return the sum of all <tt>n</tt> numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
<syntaxhighlight lang="c">int sum (int n, ... );</syntaxhighlight>
{{ExampleBox|sum(2, 1, 2)| 3 | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial sp
mov r0, #2
mov r1, #1
mov r2, #2
bl sum
1: b 1b // done
.global sum
sum: }}
{{SubmitBox|arch=arm}}
a2f1058d784eaf4d3893e91bf84af13f2490759d
Arm/max args
0
42
118
2016-11-27T10:14:43Z
Henry
1
Created page with "Write a function with a variable number of arguments that returns the maximum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to process. The..."
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the maximum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to process. The remaining <tt>n</tt> signed integers are the numbers to proces. The function will be called with exactly <tt>n+1</tt> arguments.
If <tt>n</tt> is 0 (no numbers to process), return 0. Otherwise, return the maximum of the <tt>n</tt> numbers.
<syntaxhighlight lang="c">int max (int n, ... );</syntaxhighlight>
{{ExampleBox|max(2, 1, 2)| 2 | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial sp
mov r0, #2
mov r1, #1
mov r2, #2
bl max
.global max
max: }}
{{SubmitBox|arch=arm}}
e74fa3b092d055396ca4da851a74401c6e4ea031
120
118
2016-11-27T10:19:31Z
Henry
1
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the maximum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to process. The remaining <tt>n</tt> signed integers are the numbers to proces. The function will be called with exactly <tt>n+1</tt> arguments.
If <tt>n</tt> is 0 (no numbers to process), return 0. Otherwise, return the maximum of the <tt>n</tt> numbers.
<syntaxhighlight lang="c">int max (int n, ... );</syntaxhighlight>
{{ExampleBox|max(2, 1, 2)| 2 | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial sp
mov r0, #2
mov r1, #1
mov r2, #2
bl max
1: b 1b // done
.global max
max: }}
{{SubmitBox|arch=arm}}
d1075568965ca6d18ed830bbb50c7db922e712dc
MediaWiki:Sidebar
8
4
122
36
2016-11-27T11:25:22Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** http://nios.stuffedcow.net/|Run a Simulation (Nios II)
** http://nios.stuffedcow.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* SEARCH
* TOOLBOX
* LANGUAGES
67a6ee3708cfcb8d10b8e35ec4d3441c540cc759
Project:About
4
43
123
2016-11-27T11:27:17Z
Henry
1
Created page with "This is an assembly language version of [http://verilog.stuffedcow.net/wiki/Project:About HDLBits]."
wikitext
text/x-wiki
This is an assembly language version of [http://verilog.stuffedcow.net/wiki/Project:About HDLBits].
46c86d46761ca0f3819dd8ea527540b1f2a6a437
Arm/return123
0
16
124
59
2016-11-27T21:00:46Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123}}
{{SubmitBox|arch=arm}}
30d4a8200b3b2894e22b1930cb76e9002fd87216
126
124
2016-11-27T23:40:28Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
bl func
1: b 1b // done
.global func
func:}}
{{SubmitBox|arch=arm}}
d9e8e893752e3dd75ee78e2b58e3ddb094c63dc9
127
126
2016-11-27T23:43:40Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
ARM has several common ways to return from a function:
* <tt>mov pc, lr</tt>
* <tt>bx lr</tt>
* <tt>push {lr} ; ... ; pop {pc}</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
bl func
1: b 1b // done
.global func
func:
// return 123: Set r0 = 123 and then return from the function.
}}
{{SubmitBox|arch=arm}}
685c7c0c501f2f52c083c74072f3c02e19996696
Arm/return
0
44
125
2016-11-27T23:34:37Z
Henry
1
Created page with "Write a function named <tt>func</tt> that does nothing and simply returns. Unlike sometimes done for other assembly exercises, these problems require you to write functions,..."
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
Unlike sometimes done for other assembly exercises, these problems require you to write functions, <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>. One side effect is that even your top-level function also has to follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. The <tt>_start</tt> label isn't used when judging (the test code calls your function).
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{SubmitBox|arch=arm}}
4161915391b00498c97ed30779e347265f31c99a
144
125
2016-12-05T22:37:35Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
Unlike sometimes done for other assembly exercises, these problems require you to write functions, <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>. One side effect is that even your top-level function also has to follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{SubmitBox|arch=arm}}
8fcbcad907e39db4eb13060fb05c748114000165
145
144
2016-12-05T22:42:15Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
Unlike sometimes done for other assembly exercises, these problems require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>. One side effect is that even your top-level function also has to follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{SubmitBox|arch=arm}}
af21951476a6f79945d1fb76bdabec793187eaba
Arm/load
0
30
129
72
2016-11-28T20:39:02Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=[0x345678] = 123
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
ldr r1, =0x1234
str r1, [r0]
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
217d91c9ac489d231e4b921c63a66a4a0476af0c
130
129
2016-11-28T20:39:41Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=[0x345678] = 123
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
ldr r1, =123
str r1, [r0]
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
e5e5f41d5e51e622d6e61381f628fa2e9561ec11
142
130
2016-12-05T02:25:12Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameters: It loads a word from a hard-coded location.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=[0x345678] = 123
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
ldr r1, =123
str r1, [r0]
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
926b175903b42947b2e335cb954e34bf3b47953c
147
142
2016-12-06T05:25:46Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameters: It loads a word from a hard-coded location.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=Memory [0x345678] initialized to 123. No input to function.
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
ldr r1, =123
str r1, [r0]
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
06b0fede1ba8fad85daa9e456c9cf5016d366341
148
147
2016-12-06T05:45:54Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameters: It loads a word from a hard-coded location.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=Memory [0x345678] initialized to 123. No input to function.
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
ldr r1, =123
str r1, [r0]
movw r0, #0xbad // This is not an input into the function.
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
1724e63a4d73ec2491b95546797d03e6a2513d0e
149
148
2016-12-06T05:46:27Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameters: It loads a word from a hard-coded location.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=Memory [0x345678] initialized to 123. No input to function.
|2=123|3=
.global _start
_start:
ldr r0, =0x345678
ldr r1, =123
str r1, [r0]
movw r0, #0xbad // This function has no parameters.
movw r1, #0xbad // So destroy the value here so you won't be tempted to use it.
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
2089fdfa454aa15d292e58f6afd68e1c566f7733
Arm/linklist del
0
37
131
89
2016-11-28T21:48:58Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node passed to <tt>listdel</tt> is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
B: .word C
C: .word D
D: .word 0
.text
.global _start
ldr r0, =A
bl listdel
1: b 1b // done
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
53d8baf1bad5f00977869b9fa8893f3098a2271d
133
131
2016-11-28T21:49:30Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node passed to <tt>listdel</tt> is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
B: .word C
C: .word D
D: .word 0
.text
.global _start
_start:
ldr r0, =A
bl listdel
1: b 1b // done
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
fd25808a4ee3fe8862e1654fc02aad16d72d2573
143
133
2016-12-05T02:31:10Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node passed to <tt>listdel</tt> is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
D: .word 0
C: .word D
B: .word C
.text
.global _start
_start:
ldr r0, =A
bl listdel
1: b 1b // done
.global listdel
listdel: }}
{{SubmitBox|arch=arm}}
8c108ef8bc55b5b7fbaa7b7bd13e872fd54aeb5f
Arm/linklist len
0
36
132
91
2016-11-28T21:49:01Z
Henry
1
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will find the length of the linked list beginning at the node passed to the function as the first argument. A null pointer should return length 0. Do not attempt to detect cycles in the linked list (Cycles should cause your function to run forever.)
<syntaxhighlight lang="c">
struct node { node *next; };
unsigned int listlen(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> null | 2=3 | 3=
.data
A: .word B
B: .word C
C: .word 0
.text
.global _start
ldr r0, =A
bl listlen
1: b 1b // done
.global listlen
listlen: }}
{{SubmitBox|arch=arm}}
f7c556b64f36f7aa109313c8d8e884aafdc091ad
Arm
0
45
134
2016-11-29T11:21:21Z
Henry
1
Redirected page to [[Arm index]]
wikitext
text/x-wiki
#redirect [[Arm_index]]
f8dc959062c181ecd713506f9e4ec5d7fb5cd6bb
Arm/
0
46
135
2016-11-29T11:22:12Z
Henry
1
Redirected page to [[Arm index]]
wikitext
text/x-wiki
#redirect [[Arm_index]]
f8dc959062c181ecd713506f9e4ec5d7fb5cd6bb
Nios/
0
47
136
2016-11-29T11:22:28Z
Henry
1
Redirected page to [[Nios index]]
wikitext
text/x-wiki
#redirect [[Nios_index]]
993d10438845def701f0e3fa2320ae6a135f1aee
Nios
0
48
137
2016-11-29T11:22:37Z
Henry
1
Redirected page to [[Nios index]]
wikitext
text/x-wiki
#redirect [[Nios_index]]
993d10438845def701f0e3fa2320ae6a135f1aee
Arm/increment align
0
32
138
76
2016-11-29T11:40:29Z
Henry
1
wikitext
text/x-wiki
Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your routine must only do properly aligned accesses.
<syntaxhighlight lang="c">void inc (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|(memory changed to 1235)|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl inc
1: b 1b // Done
.global inc
inc:}}
{{SubmitBox|arch=arm}}
6da2ae4987626b9972093a4f4debca3539481237
Arm/strtolower
0
35
139
82
2016-11-29T11:45:57Z
Henry
1
wikitext
text/x-wiki
Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0.
Upper-case characters are defined as those with value between 'A' (0x41) and 'Z' (0x5a), inclusive. They should be changed to 'a' (0x61) through 'z' (0x7a).
There is no return value.
<syntaxhighlight lang="c">void strtolower (char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|"hello world"|3=
.data
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strtolower
1: b 1b
.global strtolower
strtolower:}}
{{SubmitBox|arch=arm}}
94fc1fb1c27db07389966a04df01f79dcde7a469
150
139
2016-12-06T17:36:03Z
Henry
1
wikitext
text/x-wiki
Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0.
Upper-case characters are defined as those with value between 'A' (0x41) and 'Z' (0x5a), inclusive. They should be changed to 'a' (0x61) through 'z' (0x7a).
There is no return value.
<syntaxhighlight lang="c">void strtolower (char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|"hello world"|3=
.data
.byte 0
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strtolower
1: b 1b
.global strtolower
strtolower:}}
{{SubmitBox|arch=arm}}
26f02c790a7160b44c43fc2880b0ac63f9546d0b
Arm/invert
0
27
146
66
2016-12-06T03:19:21Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the bitwise inversion of its parameter.
<syntaxhighlight lang="c">int invert (int n);</syntaxhighlight>
{{ExampleBox|1|0xfffffffe|3=
.global _start
_start:
mov r0, #1
bl invert
1: b 1b // Done
.global invert
invert:}}
{{HintBox|ARM has an instruction for inversion, but it is oddly named: "'''m'''o'''v'''e i'''n'''verse".}}
{{SubmitBox|arch=arm}}
c0d6a1e4a62f638d840970ed8e14b23b554fb115
Arm/strtolower
0
35
151
150
2016-12-06T17:36:24Z
Henry
1
wikitext
text/x-wiki
Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0.
Upper-case characters are defined as those with value between 'A' (0x41) and 'Z' (0x5a), inclusive. They should be changed to 'a' (0x61) through 'z' (0x7a).
There is no return value.
<syntaxhighlight lang="c">void strtolower (char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|"hello world"|3=
.data
.byte 0 // Strings aren't word-aligned
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strtolower
1: b 1b
.global strtolower
strtolower:}}
{{SubmitBox|arch=arm}}
1f5c883a277ba1b902ba12ee260da3a00ff8d664
192
151
2016-12-15T22:33:00Z
Henry
1
wikitext
text/x-wiki
Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0.
Upper-case characters are defined as those with value between 'A' (0x41) and 'Z' (0x5a), inclusive. They should be changed to 'a' (0x61) through 'z' (0x7a). All other characters should remain unchanged.
There is no return value.
<syntaxhighlight lang="c">void strtolower (char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|"hello world"|3=
.data
.byte 0 // Strings aren't word-aligned
MyString: .string "Hello World"
.text
.global _start
_start:
ldr r0, =MyString
bl strtolower
1: b 1b
.global strtolower
strtolower:}}
{{SubmitBox|arch=arm}}
37474d9baece3811380325858fe49cc0ae14aa08
Arm/add64
0
28
152
68
2016-12-06T18:02:08Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 64-bit integers. 64-bit operands are passed in two consecutive registers. Thus, the first parameter is in <tt>r0</tt> and <tt>r1</tt>, while the second parameter is in <tt>r2</tt> and <tt>r3</tt>, with the return value returned in <tt>r0</tt> and <tt>r1</tt>.
<syntaxhighlight lang="c">long long add64 (long long a, long long b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
mov r0, #1 // Lower 32 bits of a
mov r1, #0 // Upper 32 bits of a
mov r2, #1 // Lower 32 bits of b
mov r3, #0 // Upper 32-bits of b
bl add64
1: b 1b // Done
.global add64
add64:}}
{{HintBox|The difference between regular addition and big-integer addition is that you need to detect the carry-out from the low-order adder and feed that to the carry-in of the high-order adder (much like a ripple-carry adder). ARM's carry flag can be used for that purpose, using the <tt>adds</tt> and <tt>adc</tt> instructions.}}
{{SubmitBox|arch=arm}}
7852601f3bc4848de235ee70dd7b665c1cf7773d
Arm/popcount
0
29
153
70
2016-12-06T18:03:42Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]).
<syntaxhighlight lang="c">int popcount (int n);</syntaxhighlight>
{{ExampleBox|5
255|2
8|3=
.global _start
_start:
mov r0, #5
bl popcount
1: b 1b // Done
.global popcount
popcount:}}
{{HintBox|Make sure you test all of the corner cases (What's the smallest possible answer? Largest?).}}
{{SubmitBox|arch=arm}}
92d9d3ebdb7cbf01f39b677c51217ce6990a4e3b
Arm/abs
0
23
154
55
2016-12-07T08:17:21Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
<syntaxhighlight lang="c">int abs (int n);</syntaxhighlight>
{{ExampleBox|10
-10|10
10|3=
.global _start
_start:
mov r0, #10
bl abs
1: b 1b // Done
.global abs
abs:}}
{{HintBox|ARM does have a negation instruction, but it is oddly named: '''r'''everse '''s'''u'''b'''tract from #0. There is also a less oddly-named alias called '''neg'''. }}
{{SubmitBox|arch=arm}}
5430736deed93ab63f2ce21ac7602643675e4fd6
Arm/fib1
0
49
155
2016-12-08T03:51:11Z
Henry
1
Created page with "The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are..."
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write a function that computes the value of the n<sup>th</sup> Fibonacci number.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
You may assume that the input will be small enough to run in a reasonable amount of time when implemented using recursion. (The execution time budget is approx 40 instructions per call to <tt>fib</tt>, if implemented recursively.)
{{ExampleBox|fib(4) | 5|
.global _start
_start:
mov r0, #4
bl fib
1: b 1b
.global fib
fib:}}
{{SubmitBox|arch=arm}}
6f0e1e43b23a843020e89176f6f97ad7b9644339
Arm index
0
19
156
128
2016-12-08T03:52:02Z
Henry
1
/* Problem Set for ARMv7 */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
7f68598d9d2123190fc79b10cf4cfebefb3595c0
159
156
2016-12-08T04:05:38Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
c279cf1e7d4785c4e6824633ea19d6793965a5a6
161
159
2016-12-08T05:03:35Z
Henry
1
/* Functions */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
4da35276889855866dd265b83a92657a8693b148
163
161
2016-12-08T07:29:25Z
Henry
1
/* Problem Set for ARMv7 */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
0a2e4de6b2978944369857a8910f3c894c8599c0
169
163
2016-12-08T10:25:24Z
Henry
1
/* Functions */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree</vlgstat>
324356ddd40ef2aa586086a994e3b2fff755c5e6
171
169
2016-12-08T11:35:46Z
Henry
1
/* Functions */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
fdf806df429e769996d0ae39f6c13324453b73d9
178
171
2016-12-08T12:53:10Z
Henry
1
/* Functions */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
5212773467c6c608f1bc487c43c9ade6f2665697
185
178
2016-12-09T01:58:20Z
Henry
1
/* Functions */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
c8139360c40867112e587451b7fb1638ded4a62a
Arm/fib2
0
50
157
2016-12-08T04:04:37Z
Henry
1
Created page with "The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are..."
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="arm/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4) | 5|
.global _start
_start:
mov r0, #4
bl fib
1: b 1b
.global fib
fib:}}
{{SubmitBox|arch=arm}}
78ee51c913db585575125e06d25c08b4eea90724
158
157
2016-12-08T04:04:54Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (possibly non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="arm/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4) | 5|
.global _start
_start:
mov r0, #4
bl fib
1: b 1b
.global fib
fib:}}
{{SubmitBox|arch=arm}}
2d4d22268b6548c56d7b19c81e434548fd8b940a
183
158
2016-12-08T13:11:14Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (possibly non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="arm/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4)|5|
.global _start
_start:
mov r0, #4
bl fib
1: b 1b
.global fib
fib:}}
{{SubmitBox|arch=arm}}
064b4c7ef0028a5d42b61be07399a4468062e6e5
Arm/fib3
0
51
160
2016-12-08T05:03:16Z
Henry
1
Created page with "The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are..."
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Suppose you computed the n<sup>th</sup> Fibonacci number directly using the above recursive formulation (no other optimizations or memoization, etc). How many calls to the function <tt>fib</tt> are required? For example, fib(2) requires 3 calls: One to compute fib(0), one to compute fib(1), and then one for fib(2).
Write a function that computes the number of calls to <tt>fib</tt> required to compute the n<sup>th</sup> Fibonacci number if the algorithm were implemented recursively.
<syntaxhighlight lang="c">unsigned int numfib(unsigned int n);</syntaxhighlight>
<tt>n</tt> will be no greater than 30, to keep execution time reasonable.
{{ExampleBox|numfib(2)
numfib(4) |3
9|
.global _start
_start:
mov r0, #4
bl numfib
1: b 1b
.global numfib
numfib:}}
{{SubmitBox|arch=arm}}
b79c5db74ee9bdc58ab2b2bd72ff71a9a3f32b43
172
160
2016-12-08T11:39:23Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Suppose you computed the n<sup>th</sup> Fibonacci number directly using the above recursive formulation (no other optimizations or memoization, etc). How many calls to the function <tt>fib</tt> are required? For example, fib(2) requires 3 calls: fib(2) counts as one call, and it calls fib(1) and fib(0), both of which are base cases that don't call further functions.
Write a function that computes the number of calls to <tt>fib</tt> required to compute the n<sup>th</sup> Fibonacci number if the algorithm were implemented recursively.
<syntaxhighlight lang="c">unsigned int numfib(unsigned int n);</syntaxhighlight>
<tt>n</tt> will be no greater than 30, to keep execution time reasonable.
{{ExampleBox|numfib(2)
numfib(4) |3
9|
.global _start
_start:
mov r0, #4
bl numfib
1: b 1b
.global numfib
numfib:}}
{{SubmitBox|arch=arm}}
1dd70cb416295b71b9c581a8542aeeb88f25edc3
184
172
2016-12-08T13:15:14Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Suppose you computed the n<sup>th</sup> Fibonacci number directly using the above recursive formulation (no other optimizations or memoization, etc). How many calls to the function <tt>fib</tt> are required? For example, fib(2) requires 3 calls: fib(2) counts as one call, and it calls fib(1) and fib(0), both of which are base cases that don't call further functions.
Write a function that computes the number of calls to <tt>fib</tt> required to compute the n<sup>th</sup> Fibonacci number if the algorithm were implemented recursively.
<syntaxhighlight lang="c">unsigned int numfib(unsigned int n);</syntaxhighlight>
<tt>n</tt> will be no greater than 30, to keep execution time reasonable.
{{ExampleBox|numfib(2)
numfib(4) |3
9|
.global _start
_start:
mov r0, #4
bl numfib
1: b 1b
.global numfib
numfib:}}
{{HintBox|This is an algorithm question more than an assembly programming question. You may wish to skip this one if you're looking purely for programming (not algorithm) practice.}}
{{SubmitBox|arch=arm}}
df1c43e9e33899be3d242476e10d7182084112b5
Arm/ackermann
0
52
162
2016-12-08T07:26:18Z
Henry
1
Created page with "The [http://en.wikipedia.org/wiki/Ackermann_function Ackermann function] is a function of two parameters that grows very quickly. It is often defined recursively: <syntaxhighl..."
wikitext
text/x-wiki
The [http://en.wikipedia.org/wiki/Ackermann_function Ackermann function] is a function of two parameters that grows very quickly. It is often defined recursively:
<syntaxhighlight lang="c">
unsigned int ackermann (unsigned int m, unsigned int n) {
if (m==0) return n+1;
else if (n==0) return ackermann(m-1, 1);
else return ackermann(m-1, ackermann(m, n-1) );
}
</syntaxhighlight>
Write a function with two parameters named <tt>ackermann</tt> that will compute the value of the Ackermann function for the two parameters.
You may assume that the input will be small enough to not overflow and will run in a reasonable amount of time when implemented using plain recursion.
{{ExampleBox|ackermann(1,1)|3|
.global _start
_start:
mov r0, #1
mov r1, #1
bl ackermann
1: b 1b
.global ackermann
ackermann:}}
{{SubmitBox|arch=arm}}
0bc63aef533cbb786146eac6bd1263767386a6c4
164
162
2016-12-08T07:45:27Z
Henry
1
wikitext
text/x-wiki
The [http://en.wikipedia.org/wiki/Ackermann_function Ackermann function] is a function of two parameters that grows very quickly. It is often defined recursively:
<syntaxhighlight lang="c">
unsigned int ackermann (unsigned int m, unsigned int n) {
if (m==0) return n+1;
else if (n==0) return ackermann(m-1, 1);
else return ackermann(m-1, ackermann(m, n-1) );
}
</syntaxhighlight>
Write a function with two parameters named <tt>ackermann</tt> that will compute the value of the Ackermann function for the two parameters.
You may assume that the input will be small enough to not overflow and will run in a reasonable amount of time when implemented using the above recursive formulation.
{{ExampleBox|ackermann(1,1)|3|
.global _start
_start:
mov r0, #1
mov r1, #1
bl ackermann
1: b 1b
.global ackermann
ackermann:}}
{{SubmitBox|arch=arm}}
d7573a457673bed49e834461c78986dd7b52ea80
Arm/load align
0
31
165
74
2016-12-08T07:53:31Z
Henry
1
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your function must emulate what an unaligned load would do, while only using properly aligned accesses,
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl load
1: b 1b // Done
.global load
load:}}
{{SubmitBox|arch=arm}}
46963af8c1e2c0df0b91174882367cedd460b5a7
182
165
2016-12-08T13:10:46Z
Henry
1
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your function must emulate what an unaligned load would do, while only using properly aligned accesses,
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl load
1: b 1b // Done
.global load
load:}}
{{HintBox|The easiest method is probably to use a sequence of byte-sized loads, as byte-sized loads have no alignment requirements.}}
{{SubmitBox|arch=arm}}
b785c2ed375effe782b1fef7113118c35e9636c7
189
182
2016-12-13T10:22:24Z
Henry
1
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your function must emulate what an unaligned load would do, while only using properly aligned accesses,
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox|Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl load
1: b 1b // Done
.global load
load:}}
{{HintBox|The easiest method is probably to use a sequence of byte-sized loads, as byte-sized loads have no alignment requirements.}}
{{SubmitBox|arch=arm}}
385f4056755756614bff7fa2d4e5f7cc79d08902
Arm/treesize
0
53
166
2016-12-08T10:19:17Z
Henry
1
Created page with "A binary tree is a data structure composed of nodes that contain up to two child nodes, with no cycles. (This is not a binary ''search'' tree, which additionally requires the..."
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
Write a function that returns the number of nodes in the tree rooted at the given node. The smallest possible tree has one node (both child pointers are null).
<syntaxhighlight lang="c">
unsigned int size (Node *p);
</syntaxhighlight>
{{ExampleBox|A[B,C], B[0,0], C[0,0]
A[0,0]|3
1|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
bl size
1: b 1b
.global size
size:}}
{{SubmitBox|arch=arm}}
6ac0448060a119356cba59a9c6f7aaebe54e7ab6
167
166
2016-12-08T10:23:50Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
Write a function that returns the number of nodes in the tree rooted at the given node. The smallest possible tree has one node (both child pointers are null).
<syntaxhighlight lang="c">
unsigned int size (Node *p);
</syntaxhighlight>
{{ExampleBox|A[B,C], B[0,0], C[0,0]
A[0,0]|3
1|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
bl size
1: b 1b
.global size
size:}}
{{SubmitBox|arch=arm}}
67d81ac612141a5fa25fe441099552fb50d6ac80
168
167
2016-12-08T10:25:00Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
Write a function that returns the number of nodes in the tree rooted at the given node. The smallest possible tree has one node (both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
unsigned int size (Node *root);
</syntaxhighlight>
{{ExampleBox|A[B,C], B[0,0], C[0,0]
A[0,0]|3
1|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
bl size
1: b 1b
.global size
size:}}
{{SubmitBox|arch=arm}}
aa316f5830bbfe4fff08136e85756fe20558c17f
Arm/treedepth
0
54
170
2016-12-08T11:34:50Z
Henry
1
Created page with "A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires..."
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
'''Write a function that returns whether the depth of the tree rooted at the given node is less than or equal to <tt>d</tt> (return 1 or 0)'''. The depth is the number of hops needed to reach the furthest node from the root, including the root node itself. The smallest possible tree has depth 1 (if both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
bool depth (Node *root, unsigned int d);
</syntaxhighlight>
{{ExampleBox|1={A[B,C], B[0,0], C[0,0]}, 2
{A[0,0]}, 0|2=1 (true: depth is 2, which is <= 2)
0 (false: depth is 1, which is not <= 0)|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
mov r1, #2
bl depth
1: b 1b
.global depth
depth:}}
{{HintBox|The question is posed so that simply making function <tt>depth</tt> recursive wouldn't be enough to solve the problem. However, it can be easily split into two functions: A recursive function to find the depth of the tree, which is called by a function that does the comparison with <tt>d</tt>. Thus, you will likely be writing two functions for this problem.}}
{{SubmitBox|arch=arm}}
8420479416794d350851f8beecc6e4cee6d7f0fc
173
170
2016-12-08T11:41:00Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
'''Write a function that returns whether the depth of the tree rooted at the given node is less than or equal to <tt>d</tt> (return 1 or 0)'''. The depth is the number of hops needed to reach the furthest node from the root, including the root node itself. The smallest possible tree has depth 1 (if both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
bool depth (Node *root, unsigned int d);
</syntaxhighlight>
{{ExampleBox|1={A[B,C], B[0,0], C[0,0]}, 2
{A[0,0]}, 0|2=1 (true: depth is 2, which is <= 2)
0 (false: depth is 1, which is not <= 0)|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
mov r1, #2
bl depth
1: b 1b
.global depth
depth:}}
{{HintBox|The question is posed so that simply making function <tt>depth</tt> recursive wouldn't be enough to solve the problem. However, it can be easily split into two functions: A recursive function to find the depth of the tree, which is called by a function that does the comparison with <tt>d</tt>. Thus, you will likely be writing two functions for this problem.
Remember: The initialization code you write for testing (at label _start) is not used during judging.}}
{{SubmitBox|arch=arm}}
ffd109b0cab3877413c89b442c540789cc387164
174
173
2016-12-08T11:41:39Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
'''Write a function that returns whether the depth of the tree rooted at the given node is less than or equal to <tt>d</tt> (return 1 or 0)'''. The depth is the number of hops needed to reach the furthest node from the root, including the root node itself. The smallest possible tree has depth 1 (if both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
bool depth (Node *root, unsigned int d);
</syntaxhighlight>
Remember: The initialization code you write for testing (at label <tt>_start</tt>) is not used during judging.
{{ExampleBox|1={A[B,C], B[0,0], C[0,0]}, 2
{A[0,0]}, 0|2=1 (true: depth is 2, which is <= 2)
0 (false: depth is 1, which is not <= 0)|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
mov r1, #2
bl depth
1: b 1b
.global depth
depth:}}
{{HintBox|The question is posed so that simply making function <tt>depth</tt> recursive wouldn't be enough to solve the problem. However, it can be easily split into two functions: A recursive function to find the depth of the tree, which is called by a function that does the comparison with <tt>d</tt>. Thus, you will likely be writing two functions for this problem.}}
{{SubmitBox|arch=arm}}
70239648205f45f296c4d19403536d5ac3dc9596
187
174
2016-12-09T05:25:06Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
'''Write a function that returns whether the depth of the tree rooted at the given node is less than or equal to <tt>d</tt> (return 1 or 0)'''. The depth is the number of hops needed to reach the furthest node from the root, including the root node itself. The smallest possible tree has depth 1 (if both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
bool depth (Node *root, unsigned int d);
</syntaxhighlight>
Remember: The initialization code you write for testing (at label <tt>_start</tt>) is not used during judging.
{{ExampleBox|1={A[B,C], B[0,0], C[0,0]}, 2
{A[0,0]}, 0|2=1 (true: depth is 2, which is <= 2)
0 (false: depth is 1, which is not <= 0)|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
mov r1, #2
bl depth
1: b 1b
.global depth
depth:}}
{{HintBox|The question is posed so that simply making function <tt>depth</tt> recursive wouldn't be enough to solve the problem. However, it can be easily split into two functions: 1. A function that compares the tree depth with <tt>d</tt>, and 2. a recursive function that returns the depth of the tree. Thus, you will likely be writing two functions for this problem.}}
{{SubmitBox|arch=arm}}
88db05fe3c41ac73b6a0408fd420f5d0780c6d6a
Arm/callparam
0
55
175
2016-12-08T12:29:49Z
Henry
1
Created page with "Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2..."
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. THe function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. Also don't forget to save <tt>lr</tt>, as the function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
bl call1234
1: b 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
mov r0, #1
mov pc, lr
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than branch-and-link) to call the function. Because you didn't use branch-and-link, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call optimization in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=arm}}
fd6fb85fe412a2215ba110771f92e250adb2365f
176
175
2016-12-08T12:31:45Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. Also don't forget to save <tt>lr</tt>, as the function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
bl call1234
1: b 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
mov r0, #1
mov pc, lr
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than branch-and-link) to call the function. Because you didn't use branch-and-link, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call optimization in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=arm}}
2d689fce02fddf0700a6a4ec5a0f2d8998965af1
Arm/callsave
0
56
177
2016-12-08T12:51:20Z
Henry
1
Created page with "Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how man..."
wikitext
text/x-wiki
Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how many of its four original parameters are equal to the return value of <tt>secret(1,2,3,4)</tt>. Since there are 4 parameters, <tt>call1234</tt> will only ever return 0 through 4. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 (int a, int b, int c, int d) {
n = secret(1,2,3,4);
return (How many of {a, b, c, d} are equal to n);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. The purpose of this problem is to exercise saving and restoring registers. You need to use the (caller-saved) function parameters passed to you, yet you must reuse the same registers to pass parameters to a function you call.
{{ExampleBox|1=call1234(1,1,2,3)|2=2, if secret(1,2,3,4) returns 1|3=
.global _start
mov r0, #1
mov r1, #1
mov r2, #2
mov r3, #3
bl call1234
1: b 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
mov r0, #1
mov pc, lr
.global call1234
call1234:}}
{{SubmitBox|arch=arm}}
f88429e6d38153e48bf60a1c509b929814101bd2
181
177
2016-12-08T12:55:30Z
Henry
1
wikitext
text/x-wiki
Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how many of its four original parameters are equal to the return value of <tt>secret(1,2,3,4)</tt>. Since there are 4 parameters, <tt>call1234</tt> will only ever return 0 through 4. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 (int a, int b, int c, int d) {
n = secret(1,2,3,4);
return (How many of {a, b, c, d} are equal to n);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. The purpose of this problem is to exercise saving and restoring registers. You need to use the (caller-saved) function parameters passed to you, yet you must reuse the same registers to pass parameters to a function you call.
{{ExampleBox|1=call1234(10,10,20,30)|2=2, if secret(1,2,3,4) returns 10|3=
.global _start
mov r0, #10
mov r1, #10
mov r2, #20
mov r3, #30
bl call1234
1: b 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
mov r0, #10
mov pc, lr
.global call1234
call1234:}}
{{SubmitBox|arch=arm}}
9a8c60e64d19cfb324fa679e3c8dc3dc05f0e765
Arm/func pack20
0
40
179
141
2016-12-08T12:54:14Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
Recall that the first 4 parameters are passed through registers <tt>r0</tt> to <tt>r3</tt>, while the rest are passed through the stack.
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
8886a6f3f125463e33111d28c018511e1bf202f9
180
179
2016-12-08T12:54:29Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
Recall that the first 4 parameters of a function are passed through registers <tt>r0</tt> to <tt>r3</tt>, while the rest are passed through the stack.
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
4885a9b20f3bde9ad118956ac0ac66efa447fddd
186
180
2016-12-09T02:33:09Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
Recall that the first 4 parameters of a function are passed through registers <tt>r0</tt> to <tt>r3</tt>, while the rest are passed through the stack.
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
add sp, #68 // Caller cleans up the stack: Remove 17 parameters.
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
305a2bdc3ede9d678e56f11622f388d500a4d33d
Arm/increment align
0
32
188
138
2016-12-13T00:41:50Z
Henry
1
wikitext
text/x-wiki
Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. Note that this pointer is not necessarily 4-byte aligned, but your routine must only do properly aligned accesses.
<syntaxhighlight lang="c">void inc (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|(memory changed to 1235)|3=
.data
.byte 0 // Test with an unaligned word.
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl inc
1: b 1b // Done
.global inc
inc:}}
{{SubmitBox|arch=arm}}
3ac91e3d9eb7a2989084f52d57ac9435bd6c0516
Arm/return
0
44
190
145
2016-12-13T23:14:41Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
These problems require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function also has to follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{SubmitBox|arch=arm}}
c12c4daf7b81a1d45817966caf16df35f86565de
191
190
2016-12-13T23:15:01Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
These problems require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{SubmitBox|arch=arm}}
079f46b6b3521375978e870b1e8faa9643c4d30d
Nios/return123
0
17
193
92
2017-01-09T04:37:28Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r2) is 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
bl func
1: b 1b // done
.global func
func:
// Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
809c72256056b11640400b99798d69edf00a71fc
194
193
2017-01-09T04:37:51Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>_start</tt> that returns 123. This implies two things:
* The return value (in r2) is 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
call func
1: br 1b // done
.global func
func:
// Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
87e5207539c5a1b8d99f2836ec550696ff4bee96
195
194
2017-01-09T04:46:13Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r2) is 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
call func
1: br 1b // done
.global func
func:
// Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
7aac8540df92c54ac5265deaa85156b7d3105ca1
196
195
2017-01-09T04:46:36Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r2) is 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
call func
1: br 1b # done
.global func
func:
# Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
c5e801282048a9546a72bee1094dc36945ada4d5
Nios/return
0
57
197
2017-01-09T04:54:07Z
Henry
1
Created page with "Write a function named <tt>func</tt> that does nothing and simply returns. These problems require you to write '''functions''', <abbr style="font-size:100%;" title="For autom..."
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
These problems require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
# This is for testing your function
call func # Call your function
# Your function should return here.
1: br 1b # Infinite loop to stop program after testing
.global func
func:
# This is where your code starts running when judging.
# Write a function here.
}}
{{SubmitBox|arch=nios2}}
acf940aa41e5e0a681d3eeca76f77f5157ee079a
Nios/invert
0
58
198
2017-01-09T05:03:00Z
Henry
1
Created page with "Write a function that returns the bitwise inversion of its parameter. <syntaxhighlight lang="c">int invert (int n);</syntaxhighlight> {{ExampleBox|1|0xfffffffe|3= .global _s..."
wikitext
text/x-wiki
Write a function that returns the bitwise inversion of its parameter.
<syntaxhighlight lang="c">int invert (int n);</syntaxhighlight>
{{ExampleBox|1|0xfffffffe|3=
.global _start
_start:
movia r4, 1
call invert
1: br 1b # Done
.global invert
invert:}}
{{HintBox|Nios II has an instruction for inversion, but it's not obvious: <tt>nor</tt>.}}
{{SubmitBox|arch=nios2}}
f1165165daad7a7f956971f30ce8581540873032
Nios/odd
0
59
199
2017-01-09T05:05:53Z
Henry
1
Created page with "Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even <syntaxhighlight lang="c">int odd (int n);</syntaxhighlight> {{ExampleBox|1 2|1 0|..."
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
movia r4, 1
call odd
1: br 1b # Done
.global odd
odd:}}
{{SubmitBox|arch=nios2}}
810158a06d2e62b3be6ba908f87621b67ccc1f94
Nios/abs
0
60
200
2017-01-09T05:13:33Z
Henry
1
Created page with "Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer. <syntaxhighlight lang="c">int abs (int n);</syntaxhighl..."
wikitext
text/x-wiki
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
<syntaxhighlight lang="c">int abs (int n);</syntaxhighlight>
{{ExampleBox|10
-10|10
10|3=
.global _start
_start:
movia r4, 10
call abs
1: br 1b # Done
.global abs
abs:}}
{{SubmitBox|arch=nios2}}
b1aa7d9aa3d6415c6eaeb33f221b742f638f87f1
Nios/add
0
61
201
2017-01-09T05:24:49Z
Henry
1
Created page with "Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. The first parameter is in <tt>r4</tt> and the second pa..."
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. The first parameter is in <tt>r4</tt> and the second parameter is in <tt>r5</tt>.
<syntaxhighlight lang="c">long long add (int a, int b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
movi r4, 1
movi r5, 1
call add
1: br 1b # Done
.global add
add:}}
{{SubmitBox|arch=nios2}}
4e27a5e52ed1da52bd6d9d1cdc4057d8fb9d0c42
Nios/add64
0
62
202
2017-01-09T05:39:31Z
Henry
1
Created page with "Write a function that returns the sum of its two parameters. The parameters and return values are both 64-bit integers. 64-bit operands are passed in two consecutive registers..."
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 64-bit integers. 64-bit operands are passed in two consecutive registers. Thus, the first parameter is in <tt>r4</tt> and <tt>r5</tt>, while the second parameter is in <tt>r6</tt> and <tt>r7</tt>, with the return value returned in <tt>r2</tt> and <tt>r3</tt>.
<syntaxhighlight lang="c">long long add64 (long long a, long long b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
movia r4, 1 # Lower 32 bits of a
movia r5, 0 # Upper 32 bits of a
movia r6, 1 # Lower 32 bits of b
movia r7, 0 # Upper 32-bits of b
call add64
1: br 1b # Done
.global add64
add64:}}
{{HintBox|The difference between regular addition and big-integer addition is that you need to detect the carry-out from the low-order adder and feed that to the high-order adder (much like a ripple-carry adder). Nios II does not have an easy way to detect carry-out from an addition. The method recommended by the ISA reference is to compare the result with one of the operands: If an addition overflows, the addition result is always (unsigned) smaller than both of its operands.}}
{{SubmitBox|arch=nios2}}
3fffd0c59fb0956c4eac3acd90a41fd780a229f6
Nios/popcount
0
63
203
2017-01-09T05:57:19Z
Henry
1
Created page with "Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]). <syntaxhighlight..."
wikitext
text/x-wiki
Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]).
<syntaxhighlight lang="c">int popcount (int n);</syntaxhighlight>
{{ExampleBox|5
255|2
8|3=
.global _start
_start:
movia r4, 5
call popcount
1: br 1b # Done
.global popcount
popcount:}}
{{HintBox|Make sure you test all of the corner cases (What's the smallest possible answer? Largest?).}}
{{SubmitBox|arch=nios2}}
b611cf64f059574d0bd8390fe97a1a437a33da8f
Nios/hailstone
0
64
204
2017-01-09T06:17:57Z
Henry
1
Created page with "A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule: * If n is ev..."
wikitext
text/x-wiki
A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule:
* If n is even, n ⇐ n / 2
* If n is odd, n ⇐ 3n + 1
It has been conjectured that the sequence always reaches 1 for any starting positive integer after some number of steps. Write a function to compute the number of steps required for a given starting number to reach 1. The starting number is a non-zero unsigned integer. You may assume that the sequences tested will not overflow a 32-bit unsigned integer.
<syntaxhighlight lang="c">unsigned int hailstone (unsigned int n);</syntaxhighlight>
{{ExampleBox|5|5 (The sequence is 5, 16, 8, 4, 2, 1)|3=
.global _start
_start:
movia r4, 5
call hailstone
1: br 1b # Done
.global hailstone
hailstone:}}
{{SubmitBox|arch=nios2}}
ba91d85e5eeb70c5cf740c0af7e9b810bf771ebf
234
204
2017-01-10T05:19:49Z
Henry
1
wikitext
text/x-wiki
A [http://en.wikipedia.org/wiki/Collatz_conjecture hailstone sequence] is a sequence of positive integers generated from a starting number by the following rule:
* If n is even, n ⇐ n / 2
* If n is odd, n ⇐ 3n + 1
It has been conjectured that the sequence always reaches 1 for any starting positive integer after some number of steps. Write a function to compute the number of steps required for a given starting number to reach 1. The starting number is a non-zero unsigned integer. You may assume that the sequences tested will not overflow a 32-bit unsigned integer.
<syntaxhighlight lang="c">unsigned int hailstone (unsigned int n);</syntaxhighlight>
{{ExampleBox|5|5 (The sequence is 5, 16, 8, 4, 2, 1)|3=
.global _start
_start:
movia sp, 0x04000000
movia r4, 5
call hailstone
1: br 1b # Done
.global hailstone
hailstone:}}
{{SubmitBox|arch=nios2}}
c8d29303cd6ea3090c0184447d1ef0a7659dc516
Nios/load
0
65
205
2017-01-09T06:28:43Z
Henry
1
Created page with "There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameter..."
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameters: It loads a word from a hard-coded location.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=Memory [0x345678] initialized to 123. No input to function.
|2=123|3=
.global _start
_start:
movia r2, 0x345678
movia r3, 123
stw r3, 0(r2)
movi r2, 0xbad # This function has no parameters.
movi r3, 0xbad # So destroy register values here so you won't be tempted to use it.
call load
1: br 1b # Done
.global load
load:}}
{{SubmitBox|arch=nios2}}
dce19b2eed45332adb86c21e0771bd43ddb51881
235
205
2017-01-10T05:19:57Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location (address) 0x345678. Write a function that reads this word from memory and returns it. Note that the function has no parameters: It loads a word from a hard-coded location.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox| 1=Memory [0x345678] initialized to 123. No input to function.
|2=123|3=
.global _start
_start:
movia sp, 0x04000000
movia r2, 0x345678
movia r3, 123
stw r3, 0(r2)
movi r2, 0xbad # This function has no parameters.
movi r3, 0xbad # So destroy register values here so you won't be tempted to use it.
call load
1: br 1b # Done
.global load
load:}}
{{SubmitBox|arch=nios2}}
9f39b4d2f094bee5df94eb838ce2f75c0476fa77
Arm/load align
0
31
206
189
2017-01-09T06:29:34Z
Henry
1
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. This pointer is not necessarily 4-byte aligned, but your function must emulate what an unaligned load would do, while only using properly aligned accesses,
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox|Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
ldr r0, =Pointer
bl load
1: b 1b // Done
.global load
load:}}
{{HintBox|The easiest method is probably to use a sequence of byte-sized loads, as byte-sized loads have no alignment requirements.}}
{{SubmitBox|arch=arm}}
6bbac4d320ad8201577f55b7c8898df78d86fc55
Nios/load align
0
66
207
2017-01-09T06:36:25Z
Henry
1
Created page with "Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. This pointer is not necessarily 4-..."
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. This pointer is not necessarily 4-byte aligned, but your function must emulate what an unaligned load would do, while only using properly aligned accesses,
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox|Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
movia r4, Pointer
call load
1: br 1b # Done
.global load
load:}}
{{HintBox|The easiest method is probably to use a sequence of byte-sized loads, as byte-sized loads have no alignment requirements.}}
{{SubmitBox|arch=nios2}}
29a072beb51d767d2b60a82a77053063117e9080
236
207
2017-01-10T05:20:16Z
Henry
1
wikitext
text/x-wiki
Write a function that reads a 32-bit word from memory and returns it. The location to read is passed as the first parameter to the function. This pointer is not necessarily 4-byte aligned, but your function must emulate what an unaligned load would do, while only using properly aligned accesses,
<syntaxhighlight lang="c">int load (int* p);</syntaxhighlight>
{{ExampleBox|Pointer: .word 1234
|1234|3=
.data
Pointer: .word 1234
.text
.global _start
_start:
movia sp, 0x04000000
movia r4, Pointer
call load
1: br 1b # Done
.global load
load:}}
{{HintBox|The easiest method is probably to use a sequence of byte-sized loads, as byte-sized loads have no alignment requirements.}}
{{SubmitBox|arch=nios2}}
f238b55acaf29e0aab8aca5e38b643105050739e
Nios/increment align
0
67
208
2017-01-09T06:42:59Z
Henry
1
Created page with "Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. This pointer is not necessarily 4-by..."
wikitext
text/x-wiki
Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. This pointer is not necessarily 4-byte aligned, but your routine must only do properly aligned accesses.
<syntaxhighlight lang="c">void inc (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|(memory changed to 1235)|3=
.data
.byte 0 # Test with an unaligned word.
Pointer: .word 1234
.text
.global _start
_start:
movia r4, Pointer
call inc
1: br 1b # Done
.global inc
inc:}}
{{SubmitBox|arch=nios}}
d8a0d4acbcb0aefc28f0afbe4cd63c9a6237de8f
209
208
2017-01-09T06:43:21Z
Henry
1
wikitext
text/x-wiki
Write a function that increments a 32-bit word located in memory. The location to modify is passed as the first parameter to the function. This pointer is not necessarily 4-byte aligned, but your routine must only do properly aligned accesses.
<syntaxhighlight lang="c">void inc (int* p);</syntaxhighlight>
{{ExampleBox| Pointer: .word 1234
|(memory changed to 1235)|3=
.data
.byte 0 # Test with an unaligned word.
Pointer: .word 1234
.text
.global _start
_start:
movia r4, Pointer
call inc
1: br 1b # Done
.global inc
inc:}}
{{SubmitBox|arch=nios}}
448568fa0e47102733e5a5d12d75fc484d47123f
Nios/strlen
0
68
210
2017-01-09T06:55:49Z
Henry
1
Created page with "Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argume..."
wikitext
text/x-wiki
Write a function named <tt>strlen</tt> that returns the length of a null-terminated string. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0. The string must not be modified.
Return (in <tt>r2</tt>) the length of the string, which excludes the null termination character;
<syntaxhighlight lang="c">unsigned int strlen (const char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|11|3=
.data
MyString: .string "Hello World"
.text
.global _start
_start:
movia r4, MyString
call strlen
1: br 1b
.global strlen
strlen:}}
{{SubmitBox|arch=nios2}}
6511849dfe77abbfb9545d0791001f1f326286f8
Nios/strtolower
0
69
211
2017-01-09T07:15:02Z
Henry
1
Created page with "Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as th..."
wikitext
text/x-wiki
Write a function that changes every upper-case character (A-Z) in a null-terminated string to lower case. The string (a pointer to an array of characters) will be passed as the first argument of the function. A string contains non-null characters and ends with a single byte with value 0.
Upper-case characters are defined as those with value between 'A' (0x41) and 'Z' (0x5a), inclusive. They should be changed to 'a' (0x61) through 'z' (0x7a). All other characters should remain unchanged.
There is no return value.
<syntaxhighlight lang="c">void strtolower (char *string);</syntaxhighlight>
{{ExampleBox|"Hello World"|"hello world"|3=
.data
.byte 0 # Strings aren't word-aligned
MyString: .string "Hello World"
.text
.global _start
_start:
movia r4, MyString
call strtolower
1: br 1b
.global strtolower
strtolower:}}
{{SubmitBox|arch=nios2}}
0f959971f47d0c2416d7ea15956d71d980c982b4
Nios/array inc
0
70
212
2017-01-09T07:24:43Z
Henry
1
Created page with "Write a function that increments (by 1) each element in an array of integers. The first argument is a pointer to the start of the array. The second argument is the number of e..."
wikitext
text/x-wiki
Write a function that increments (by 1) each element in an array of integers. The first argument is a pointer to the start of the array. The second argument is the number of elements in the array.
There is no return value.
<syntaxhighlight lang="c">void array_inc (int *array, unsigned int n);</syntaxhighlight>
{{ExampleBox|[1 2 3 4]|[2 3 4 5] |3=
.data
Array: .word 1, 2, 3, 4
.text
.global _start
_start:
movia r4, Array
movia r5, 4
call array_inc
1: br 1b # Done
.global array_inc
array_inc:}}
{{SubmitBox|arch=nios2}}
ae35e155514128fb9cac919b1202f8ba5f66643a
Nios/linklist del
0
71
213
2017-01-09T07:43:41Z
Henry
1
Created page with "In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with val..."
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will remove the successor of a given node from the linked list. It does this by changing the <tt>next</tt> pointer of the given node to point to <tt>next->next</tt> (skipping over its successor node). To keep the problem simpler, we're removing the successor of the given node rather than the node itself, as it doesn't require searching through the singly-linked list to find a node's predecessor.
If it is not possible to remove the successor node (e.g., the node passed to <tt>listdel</tt> is null or its successor is null), return null. Otherwise, return a pointer to the node that was removed.
<syntaxhighlight lang="c">
struct node { node *next; };
node* listdel(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> D-> null
listdel(A) | 2=A -> C -> D -> null
returns B | 3=
.data
A: .word B
D: .word 0
C: .word D
B: .word C
.text
.global _start
_start:
movia r4, A
call listdel
1: br 1b # done
.global listdel
listdel: }}
{{SubmitBox|arch=nios2}}
a0967e6dda59226e283f478d6b20768c856edd16
Nios/linklist len
0
72
214
2017-01-09T07:50:05Z
Henry
1
Created page with "In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with val..."
wikitext
text/x-wiki
In this problem, we will be working with a simple linked list. Each list element only contains a single word that is a pointer to the next node in the list. A pointer with value 0 (null pointer) indicates that the current node is the end of the list.
Write a function that will find the length of the linked list beginning at the node passed to the function as the first argument. A null pointer should return length 0. Do not attempt to detect cycles in the linked list (Cycles should cause your function to run forever.)
<syntaxhighlight lang="c">
struct node { node *next; };
unsigned int listlen(node* list);</syntaxhighlight>
{{ExampleBox|1=A -> B -> C -> null | 2=3 | 3=
.data
A: .word B
B: .word C
C: .word 0
.text
.global _start
movia r4, A
call listlen
1: br 1b # done
.global listlen
listlen: }}
{{SubmitBox|arch=nios2}}
d5938ec1e772fd76af7d0510eb686c20856e403c
Nios/memmove
0
73
215
2017-01-09T18:51:59Z
Henry
1
Created page with "Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still wor..."
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still work correctly (contrast <tt>memmove</tt> with <tt>memcpy</tt>). The source and destination are byte-aligned, and length can be any number of bytes.
You may assume the source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source and source+length <= 4GB).
<syntaxhighlight lang="c">void memmove (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 16
call memmove
1: br 1b # Done
.global memmove
memmove:}}
{{SubmitBox|arch=nios}}
5fc28ce4311aeb1d29887ec15e37347297cd87bf
242
215
2017-01-10T05:26:19Z
Henry
1
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still work correctly (contrast <tt>memmove</tt> with <tt>memcpy</tt>). The source and destination are byte-aligned, and length can be any number of bytes.
You may assume the source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source and source+length <= 4GB).
<syntaxhighlight lang="c">void memmove (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 16
call memmove
1: br 1b # Done
.global memmove
memmove:}}
{{SubmitBox|arch=nios2}}
c136e25d9dce7f29d5e72b591ee143323554291a
247
242
2017-01-10T06:10:37Z
Henry
1
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still work correctly (contrast <tt>memmove</tt> with <vlgstat tc="nios/memcpy"/>). The source and destination are byte-aligned, and length can be any number of bytes.
You may assume the source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source and source+length <= 4GB).
<syntaxhighlight lang="c">void memmove (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 16
call memmove
1: br 1b # Done
.global memmove
memmove:}}
{{SubmitBox|arch=nios2}}
886e2eba6c1fa146096c2a6b681dec6142670556
Nios/func pack3
0
74
216
2017-01-09T18:58:36Z
Henry
1
Created page with "Write a function that stores three integers into consecutive words in memory. The function should write <tt>n1</tt>, <tt>n2</tt>, and <tt>n3</tt> (in that order, lowest to hig..."
wikitext
text/x-wiki
Write a function that stores three integers into consecutive words in memory. The function should write <tt>n1</tt>, <tt>n2</tt>, and <tt>n3</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. You may assume that <tt>array</tt> is properly aligned for words (4-byte aligned).
There is no return value.
<syntaxhighlight lang="c">void pack3 (int* array, int n1, int n2, int n3);</syntaxhighlight>
{{ExampleBox| 0x20000, 3, 4, 5 |
Writes 3 to [0x20000], 4 to [0x20004], and 5 to [0x20008] | 3=
.global _start
_start:
movia r4, 0x20000
movi r5, 3
movi r6, 4
movi r7, 5
call pack3
1: br 1b # done
.global pack3
pack3: }}
{{SubmitBox|arch=nios2}}
757f0ec525f254c9260217021f9b66e2b1ccdd74
237
216
2017-01-10T05:20:50Z
Henry
1
wikitext
text/x-wiki
Write a function that stores three integers into consecutive words in memory. The function should write <tt>n1</tt>, <tt>n2</tt>, and <tt>n3</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. You may assume that <tt>array</tt> is properly aligned for words (4-byte aligned).
There is no return value.
<syntaxhighlight lang="c">void pack3 (int* array, int n1, int n2, int n3);</syntaxhighlight>
{{ExampleBox| 0x20000, 3, 4, 5 |
Writes 3 to [0x20000], 4 to [0x20004], and 5 to [0x20008] | 3=
.global _start
_start:
movia sp, 0x04000000
movia r4, 0x20000
movi r5, 3
movi r6, 4
movi r7, 5
call pack3
1: br 1b # done
.global pack3
pack3: }}
{{SubmitBox|arch=nios2}}
16f6a5626b6c6322c08957a8272bab869eeafb89
Nios/callparam
0
75
217
2017-01-09T19:21:56Z
Henry
1
Created page with "Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2..."
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r4</tt> through <tt>r7</tt>. Also don't forget to save <tt>ra</tt>, as a function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
call call1234
1: br 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
movi r2, 1
ret
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than <tt>call</tt>) to call the function. Because you didn't use call, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call elimination in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=nios2}}
cc265dcc6fefd65f20437f4f7fa080a90696ac2d
238
217
2017-01-10T05:21:18Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r4</tt> through <tt>r7</tt>. Also don't forget to save <tt>ra</tt>, as a function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
movia sp, 0x04000000
call call1234
1: br 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
movi r2, 1
ret
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than <tt>call</tt>) to call the function. Because you didn't use call, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call elimination in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=nios2}}
0d81cd886b1a35c436af74b5b7416873675d145d
Nios/func pack20
0
76
218
2017-01-09T19:43:08Z
Henry
1
Created page with "Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that o..."
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
Recall that the first 4 parameters of a function are passed through registers <tt>r4</tt> to <tt>r7</tt>, while the rest are passed through the stack.
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20004], ... 22 to [0x20013] | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial SP
movia r4, 0x20000
movi r5, 22
movi r6, 17
1: subi sp, sp, 4 # Push 17 parameters
stw r5, (sp)
subi r5, r5, 1
subi r6, r6, 1
bne r6, r0, 1b
movi r5, 3
movi r6, 4
movi r7, 5
call pack20
addi sp, sp, 68 # Caller cleans up the stack: Remove 17 parameters.
1: br 1b # done
.global pack20
pack20: }}
{{SubmitBox|arch=nios2}}
dc6448aa94db86db84a3d950eabe90f3ce27209e
Arm/callsave
0
56
219
181
2017-01-09T20:09:28Z
Henry
1
wikitext
text/x-wiki
Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how many of its four original parameters are equal to the return value of <tt>secret(1,2,3,4)</tt>. Since there are 4 parameters, <tt>call1234</tt> will only ever return 0 through 4. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 (int a, int b, int c, int d) {
n = secret(1,2,3,4);
return (How many of {a, b, c, d} are equal to n);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. The purpose of this problem is to exercise saving and restoring registers. You need to use the (caller-saved) function parameters passed to you, yet you must reuse the same registers to pass parameters to a function you call.
{{ExampleBox|1=call1234(10,10,20,30)|2=2, if secret(1,2,3,4) returns 10|3=
.global _start
ldr sp, =0x40000000
mov r0, #10
mov r1, #10
mov r2, #20
mov r3, #30
bl call1234
1: b 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
mov r0, #10
mov pc, lr
.global call1234
call1234:}}
{{SubmitBox|arch=arm}}
4f6beb4e7ac1299143bd4a8d2206757cddd313af
Nios/callsave
0
77
220
2017-01-09T20:15:08Z
Henry
1
Created page with "Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how man..."
wikitext
text/x-wiki
Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how many of its four original parameters are equal to the return value of <tt>secret(1,2,3,4)</tt>. Since there are 4 parameters, <tt>call1234</tt> will only ever return 0 through 4. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 (int a, int b, int c, int d) {
n = secret(1,2,3,4);
return (How many of {a, b, c, d} are equal to n);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r4</tt> through <tt>r7</tt>. The purpose of this problem is to exercise saving and restoring registers. You need to use the (caller-saved) function parameters passed to you, yet you must reuse the same registers to pass parameters to a function you call.
{{ExampleBox|1=call1234(10,10,20,30)|2=2, if secret(1,2,3,4) returns 10|3=
.global _start
movia sp, 0x04000000
movia r4, 10
movia r5, 10
movia r6, 20
movia r7, 30
call call1234
1: br 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
movi r2, 10
ret
.global call1234
call1234:}}
{{SubmitBox|arch=nios2}}
3d283e8fc30c222d8ba3ab452f9f859bfa0cf8bc
Nios/sum args
0
78
221
2017-01-09T20:34:28Z
Henry
1
Created page with "Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to sum. The remaini..."
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the sum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to sum. The remaining <tt>n</tt> integers are the numbers to sum. The function will be called with exactly <tt>n+1</tt> arguments.
Return the sum of all <tt>n</tt> numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
<syntaxhighlight lang="c">int sum (int n, ... );</syntaxhighlight>
{{ExampleBox|sum(2, 1, 2)| 3 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
movia r4, 2
movia r5, 1
movia r6, 2
call sum
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
8f28afa6f0e2634ee03494ade8df8bb768af8507
Nios/max args
0
79
222
2017-01-09T21:23:04Z
Henry
1
Created page with "Write a function with a variable number of arguments that returns the maximum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to process. The..."
wikitext
text/x-wiki
Write a function with a variable number of arguments that returns the maximum of all of its arguments. The first argument <tt>n</tt> tells you how many numbers to process. The remaining <tt>n</tt> signed integers are the numbers to proces. The function will be called with exactly <tt>n+1</tt> arguments.
If <tt>n</tt> is 0 (no numbers to process), return 0. Otherwise, return the maximum of the <tt>n</tt> numbers.
<syntaxhighlight lang="c">int max (int n, ... );</syntaxhighlight>
{{ExampleBox|max(2, 1, 2)| 2 | 3=
.global _start
_start:
movia sp, 0x40000000 # Initial sp
movia r4, 2
movia r5, 1
movia r6, 2
call max
1: br 1b # done
.global max
max: }}
{{SubmitBox|arch=nios2}}
d4be1cc0fbc660f080630d3ec9f67aa08719fc80
Arm/fib2
0
50
223
183
2017-01-09T22:04:37Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (possibly non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> Fibonacci number will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="arm/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4)|5|
.global _start
_start:
mov r0, #4
bl fib
1: b 1b
.global fib
fib:}}
{{SubmitBox|arch=arm}}
ec69cf5eaaa26cd0120557e54d9e5feeeac79acc
Nios/fib1
0
80
224
2017-01-09T22:22:46Z
Henry
1
Created page with "The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are..."
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write a function that computes the value of the n<sup>th</sup> Fibonacci number.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
You may assume that the input will be small enough to run in a reasonable amount of time when implemented using recursion. (The execution time budget is approx 40 instructions per call to <tt>fib</tt>, if implemented recursively.)
{{ExampleBox|fib(4) | 5|
.global _start
_start:
movi r4, 4
call fib
1: br 1b
.global fib
fib:}}
{{SubmitBox|arch=nios2}}
63a6caab9b7e55552e3b7a3492f81d823ecc5b9a
239
224
2017-01-10T05:21:43Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write a function that computes the value of the n<sup>th</sup> Fibonacci number.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
You may assume that the input will be small enough to run in a reasonable amount of time when implemented using recursion. (The execution time budget is approx 40 instructions per call to <tt>fib</tt>, if implemented recursively.)
{{ExampleBox|fib(4) | 5|
.global _start
_start:
movia sp, 0x04000000
movi r4, 4
call fib
1: br 1b
.global fib
fib:}}
{{SubmitBox|arch=nios2}}
1a5b97e50787e2cd606ad8d29256079a385306bb
Nios/fib2
0
81
225
2017-01-09T22:25:45Z
Henry
1
Created page with "The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are..."
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (possibly non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> Fibonacci number will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="nios/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4)|5|
.global _start
_start:
mov r0, #4
bl fib
1: b 1b
.global fib
fib:}}
{{SubmitBox|arch=nios2}}
e4c0310c8f398e993916fdb211b25f3ae3803090
226
225
2017-01-09T22:35:31Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (possibly non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> Fibonacci number will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="nios/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4)|5|
.global _start
_start:
movi r4, 4
call fib
1: br 1b
.global fib
fib:}}
{{SubmitBox|arch=nios2}}
7d55ab4e922dd91e203284fd038cc960a9499904
240
226
2017-01-10T05:21:50Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Write an <b>efficient</b> (possibly non-recursive) function that computes the value of the n<sup>th</sup> Fibonacci number. In addition, if the n<sup>th</sup> Fibonacci number will overflow an unsigned integer, return 0 to indicate an overflow.
<syntaxhighlight lang="c">unsigned int fib(unsigned int n);</syntaxhighlight>
The input will '''not''' be small enough to run in a reasonable amount of time if implemented using plain recursion. The input test cases are bigger and have a lower runtime limit than <vlgstat tc="nios/fib1">fib1</vlgstat>.
{{ExampleBox|fib(4)|5|
.global _start
_start:
movia sp, 0x04000000
movi r4, 4
call fib
1: br 1b
.global fib
fib:}}
{{SubmitBox|arch=nios2}}
a9bdd7ffb71b991e8707c22cdf928f227b5d2ac1
Nios/fib3
0
82
227
2017-01-09T22:50:53Z
Henry
1
Created page with "The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are..."
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Suppose you computed the n<sup>th</sup> Fibonacci number directly using the above recursive formulation (no other optimizations or memoization, etc). How many calls to the function <tt>fib</tt> are required? For example, fib(2) requires 3 calls: fib(2) counts as one call, and it calls fib(1) and fib(0), both of which are base cases that don't call further functions.
Write a function that computes the number of calls to <tt>fib</tt> required to compute the n<sup>th</sup> Fibonacci number if the algorithm were implemented recursively.
<syntaxhighlight lang="c">unsigned int numfib(unsigned int n);</syntaxhighlight>
<tt>n</tt> will be no greater than 30, to keep execution time reasonable.
{{ExampleBox|numfib(2)
numfib(4) |3
9|
.global _start
_start:
movi r4, 4
call numfib
1: br 1b
.global numfib
numfib:}}
{{HintBox|This is an algorithm question more than an assembly programming question. You may wish to skip this one if you're looking purely for programming (not algorithm) practice.}}
{{SubmitBox|arch=nios2}}
ae0d00c1281862d1faee25135c41671182e5e3c7
241
227
2017-01-10T05:22:01Z
Henry
1
wikitext
text/x-wiki
The Fibonacci sequence can be defined recursively. The n<sup>th</sup> Fibonacci number is the sum of the (n-1)<sup>th</sup> and (n-2)<sup>th</sup> Fibonacci number. There are two base cases: The 0<sup>th</sup> and 1<sup>st</sup> Fibonacci number are both 1.
Suppose you computed the n<sup>th</sup> Fibonacci number directly using the above recursive formulation (no other optimizations or memoization, etc). How many calls to the function <tt>fib</tt> are required? For example, fib(2) requires 3 calls: fib(2) counts as one call, and it calls fib(1) and fib(0), both of which are base cases that don't call further functions.
Write a function that computes the number of calls to <tt>fib</tt> required to compute the n<sup>th</sup> Fibonacci number if the algorithm were implemented recursively.
<syntaxhighlight lang="c">unsigned int numfib(unsigned int n);</syntaxhighlight>
<tt>n</tt> will be no greater than 30, to keep execution time reasonable.
{{ExampleBox|numfib(2)
numfib(4) |3
9|
.global _start
_start:
movia sp, 0x04000000
movi r4, 4
call numfib
1: br 1b
.global numfib
numfib:}}
{{HintBox|This is an algorithm question more than an assembly programming question. You may wish to skip this one if you're looking purely for programming (not algorithm) practice.}}
{{SubmitBox|arch=nios2}}
8ae476e4df52a89b74fc97d76fe5760d09a446c2
Arm/treesize
0
53
228
168
2017-01-09T22:52:49Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the child nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
Write a function that returns the number of nodes in the tree rooted at the given node. The smallest possible tree has one node (both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
unsigned int size (Node *root);
</syntaxhighlight>
{{ExampleBox|A[B,C], B[0,0], C[0,0]
A[0,0]|3
1|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
ldr r0, =A
bl size
1: b 1b
.global size
size:}}
{{SubmitBox|arch=arm}}
d2694b7885c1da4b27864d758b366381718c6af9
Nios/treesize
0
83
229
2017-01-09T23:09:28Z
Henry
1
Created page with "A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires..."
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the child nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
Write a function that returns the number of nodes in the tree rooted at the given node. The smallest possible tree has one node (both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
unsigned int size (Node *root);
</syntaxhighlight>
{{ExampleBox|A[B,C], B[0,0], C[0,0]
A[0,0]|3
1|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
movia r4, A
call size
1: br 1b
.global size
size:}}
{{SubmitBox|arch=nios2}}
67ce4a1734223babd4ffc9c45d731a661e691bb6
230
229
2017-01-10T03:03:05Z
Henry
1
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the child nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
Write a function that returns the number of nodes in the tree rooted at the given node. The smallest possible tree has one node (both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
unsigned int size (Node *root);
</syntaxhighlight>
{{ExampleBox|A[B,C], B[0,0], C[0,0]
A[0,0]|3
1|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
movia sp, 0x04000000
movia r4, A
call size
1: br 1b
.global size
size:}}
{{SubmitBox|arch=nios2}}
fe64936821168bec521a7a5d87bc573cc69a14e1
Nios/treedepth
0
84
231
2017-01-10T04:28:27Z
Henry
1
Created page with "A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires..."
wikitext
text/x-wiki
A binary tree is a data structure composed of nodes that contain up to two child nodes each, with no cycles. (This is not a binary ''search'' tree, which additionally requires the children nodes to be ordered.)
This problem uses nodes that have two fields: Pointers to the two child nodes. There is no data field.
<syntaxhighlight lang="c">
struct Node {
Node *a;
Node *b;
};
</syntaxhighlight>
Starting at a node, the tree rooted at that node can be explored by recursively visiting each of its child nodes (if it is not a null pointer). A Node where both child pointers are 0 has no children (is a leaf node).
'''Write a function that returns whether the depth of the tree rooted at the given node is less than or equal to <tt>d</tt> (return 1 or 0)'''. The depth is the number of hops needed to reach the furthest node from the root, including the root node itself. The smallest possible tree has depth 1 (if both child pointers are null). You may assume <tt>root</tt> is always a valid tree.
<syntaxhighlight lang="c">
bool depth (Node *root, unsigned int d);
</syntaxhighlight>
Remember: The initialization code you write for testing (at label <tt>_start</tt>) is not used during judging.
{{ExampleBox|1={A[B,C], B[0,0], C[0,0]}, 2
{A[0,0]}, 0|2=1 (true: depth is 2, which is <= 2)
0 (false: depth is 1, which is not <= 0)|3=
.data
A: .word B, C
B: .word 0, 0
C: .word 0, 0
.text
.global _start
_start:
movia sp, 0x04000000
movia r4, A # Is depth of A...
movi r5, 2 # <= 2 ?
call depth
1: br 1b
.global depth
depth:}}
{{HintBox|The question is posed so that simply making function <tt>depth</tt> recursive wouldn't be enough to solve the problem. However, it can be easily split into two functions: 1. A function that compares the tree depth with <tt>d</tt>, and 2. a recursive function that returns the depth of the tree. Thus, you will likely be writing two functions for this problem.}}
{{SubmitBox|arch=nios2}}
90f0d6f61d9162e739d014b8ce85c4ee7ee34830
Nios/ackermann
0
85
232
2017-01-10T05:11:53Z
Henry
1
Created page with "The [http://en.wikipedia.org/wiki/Ackermann_function Ackermann function] is a function of two parameters that grows very quickly. It is often defined recursively: <syntaxhighl..."
wikitext
text/x-wiki
The [http://en.wikipedia.org/wiki/Ackermann_function Ackermann function] is a function of two parameters that grows very quickly. It is often defined recursively:
<syntaxhighlight lang="c">
unsigned int ackermann (unsigned int m, unsigned int n) {
if (m==0) return n+1;
else if (n==0) return ackermann(m-1, 1);
else return ackermann(m-1, ackermann(m, n-1) );
}
</syntaxhighlight>
Write a function with two parameters named <tt>ackermann</tt> that will compute the value of the Ackermann function for the two parameters.
You may assume that the input will be small enough to not overflow and will run in a reasonable amount of time when implemented using the above recursive formulation.
{{ExampleBox|ackermann(1,1)|3|
.global _start
_start:
movia sp, 0x04000000
movi r4, 1
movi r5, 1
call ackermann
1: br 1b
.global ackermann
ackermann:}}
{{SubmitBox|arch=nios2}}
72d540e77504318bab93a3e237e9079990ad1a9d
Nios index
0
18
233
96
2017-01-10T05:15:58Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
d08cb3adf3c917d11aca91e66fb5a717de4912a9
246
233
2017-01-10T06:08:24Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
eb68324d33ea4c415f320379937368729512c033
249
246
2017-01-10T06:12:13Z
Henry
1
/* Problem Set for Nios II */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
89f75c7851287554b05c058a2637766dffdd46c2
Nios/memcpy
0
86
243
2017-01-10T05:38:42Z
Henry
1
Created page with "Write a function that copies a block of memory from the source location to the destination location. The source and destination are byte-aligned, and length can be any number..."
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination are byte-aligned, and length can be any number of bytes.
The source and destination arrays will not overlap. The source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source, and source+length <= 4GB).
<syntaxhighlight lang="c">void memcpy (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 16
call memcpy
1: br 1b # Done
.global memcpy
memcpy:}}
{{SubmitBox|arch=nios2}}
11765fddce557084605fc32e7ab84179d274c662
Arm/memcpy
0
87
244
2017-01-10T06:05:49Z
Henry
1
Created page with "Write a function that copies a block of memory from the source location to the destination location. The source and destination are byte-aligned, and length can be any number..."
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination are byte-aligned, and length can be any number of bytes.
The source and destination arrays will not overlap. The source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source, and source+length <= 4GB).
<syntaxhighlight lang="c">void memcpy (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
ldr r0, =Dest
ldr r1, =Src
ldr r2, =16
bl memcpy
1: b 1b // Done
.global memcpy
memcpy:}}
{{SubmitBox|arch=arm}}
fc8d5e7f17b15f2a6c87c7b7335825c0939e1607
Arm index
0
19
245
185
2017-01-10T06:08:11Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
ea068d4bbb72d27ba2753924dedfca4f47f6bacf
Arm/memmove
0
33
248
78
2017-01-10T06:10:53Z
Henry
1
wikitext
text/x-wiki
Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still work correctly (contrast <tt>memmove</tt> with <vlgstat tc="arm/memcpy"/>). The source and destination are byte-aligned, and length can be any number of bytes.
You may assume the source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source and source+length <= 4GB).
<syntaxhighlight lang="c">void memmove (char* destination, char* source, unsigned int length);</syntaxhighlight>
{{ExampleBox|0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 |
0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb|3=
.data
.word 0x9999
Dest: .word 0, 0, 0, 0, 0xaaaa
Src: .word 1, 2, 3, 4, 0xbbbb
.text
.global _start
_start:
ldr r0, =Dest
ldr r1, =Src
ldr r2, =16
bl memmove
1: b 1b // Done
.global memmove
memmove:}}
{{SubmitBox|arch=arm}}
ae8997e53df6050f2aadd10ffb7765de6557a74e
Template:SubmitBox
10
15
250
111
2017-01-10T06:40:17Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); this.form.submit();">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://nios.stuffedcow.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "http://nios.stuffedcow.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
6651fbd1af04609fb26f5d77cfe6deb754668fc6
Nios/return
0
57
251
197
2017-01-10T06:43:36Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
# This is for testing your function
call func # Call your function
# Your function should return here.
1: br 1b # Infinite loop to stop program after testing
.global func
func:
# This is where your code starts running when judging.
# Write a function here.
}}
{{SubmitBox|arch=nios2}}
f85d4daea496c55b212dabb6f9e8b17016e7e8b6
259
251
2017-02-26T05:57:21Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, if your function doesn't return correctly, or if it takes too long to run, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
# This is for testing your function
call func # Call your function
# Your function should return here.
1: br 1b # Infinite loop to stop program after testing
.global func
func:
# This is where your code starts running when judging.
# Write a function here.
}}
{{SubmitBox|arch=nios2}}
1270c8a3b8a18b83d604350b0372d16dbc2fc291
Arm/return
0
44
252
191
2017-01-10T06:43:48Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{SubmitBox|arch=arm}}
4b3a5d4d44f601858e9634a967702dc744d58f45
Nios/invert
0
58
253
198
2017-01-21T02:42:05Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the bitwise inversion of its parameter.
<syntaxhighlight lang="c">int invert (int n);</syntaxhighlight>
{{ExampleBox|1|0xfffffffe|3=
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4. Return value is always in r2.
call invert
1: br 1b # Done
.global invert
invert:}}
{{HintBox|Nios II has an instruction for inversion, but it's not obvious: <tt>nor</tt>.}}
{{SubmitBox|arch=nios2}}
6aa09c1a3199936479a7616ce52774f59bfc0ade
254
253
2017-01-21T02:42:24Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the bitwise inversion of its parameter.
<syntaxhighlight lang="c">int invert (int n);</syntaxhighlight>
{{ExampleBox|1|0xfffffffe|3=
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call invert # Return value is always in r2.
1: br 1b # Done
.global invert
invert:}}
{{HintBox|Nios II has an instruction for inversion, but it's not obvious: <tt>nor</tt>.}}
{{SubmitBox|arch=nios2}}
d86b98bcf7ef8e74c6e45e893cbdcbf159ff565d
Nios/odd
0
59
255
199
2017-01-25T04:05:36Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call odd # Return value is always in r2.
1: br 1b # Done
.global odd
odd:}}
{{SubmitBox|arch=nios2}}
d23abbc1612811736d6f5b3b32dbf77d1d5d75c4
261
255
2017-02-26T07:06:28Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even. Your algorithm should be O(1) because there is a runtime limit on your function of 10000 instructions.
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call odd # Return value is always in r2.
1: br 1b # Done
.global odd
odd:}}
{{SubmitBox|arch=nios2}}
855692ce67c7c835f1083e41eea05dcecb2ef547
263
261
2017-02-26T07:17:50Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even. Your algorithm's runtime should not grow with the value of <tt>n</tt> because there is a runtime limit on your function of 10000 instructions.
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call odd # Return value is always in r2.
1: br 1b # Done
.global odd
odd:}}
{{SubmitBox|arch=nios2}}
c1594304d2b539cc5e9d6d7e985abdc80f1c1f4e
Nios/abs
0
60
256
200
2017-01-25T04:05:54Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
<syntaxhighlight lang="c">int abs (int n);</syntaxhighlight>
{{ExampleBox|10
-10|10
10|3=
.global _start
_start:
movia r4, 10 # First function parameter is always passed through r4.
call abs # Return value is always in r2.
1: br 1b # Done
.global abs
abs:}}
{{SubmitBox|arch=nios2}}
cb74a53fdf7306f09ce2c5c2f684e052239883de
Nios/add
0
61
257
201
2017-01-25T04:06:43Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. The first parameter is in <tt>r4</tt> and the second parameter is in <tt>r5</tt>.
<syntaxhighlight lang="c">long long add (int a, int b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
movi r4, 1 # First function parameter is always passed through r4.
movi r5, 1 # Second function parameter is always passed through r5.
call add # Return value is always in r2.
1: br 1b # Done
.global add
add:}}
{{SubmitBox|arch=nios2}}
a82afa5957082350123d85377678a77406914027
271
257
2017-10-03T21:36:30Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. As always, the first parameter is in <tt>r4</tt> and the second parameter is in <tt>r5</tt>.
<syntaxhighlight lang="c">long long add (int a, int b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
movi r4, 1 # First function parameter is always passed through r4.
movi r5, 1 # Second function parameter is always passed through r5.
call add # Return value is always in r2.
1: br 1b # Done
.global add
add:}}
{{SubmitBox|arch=nios2}}
3c399f854027fbea843fc19552ed0e80c772d2c4
272
271
2017-10-03T21:36:55Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. As always, the first parameter is in <tt>r4</tt> and the second parameter is in <tt>r5</tt>.
<syntaxhighlight lang="c">int add (int a, int b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
movi r4, 1 # First function parameter is always passed through r4.
movi r5, 1 # Second function parameter is always passed through r5.
call add # Return value is always in r2.
1: br 1b # Done
.global add
add:}}
{{SubmitBox|arch=nios2}}
62368dba925fad099ef472bb8de58cba65d3b23f
Nios/add64
0
62
258
202
2017-01-25T04:08:26Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 64-bit integers. 64-bit operands are passed in two consecutive registers. Thus, the first parameter is in <tt>r4</tt> and <tt>r5</tt>, while the second parameter is in <tt>r6</tt> and <tt>r7</tt>, with the return value returned in <tt>r2</tt> and <tt>r3</tt>.
<syntaxhighlight lang="c">long long add64 (long long a, long long b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
movia r4, 1 # Lower 32 bits of a
movia r5, 0 # Upper 32 bits of a
movia r6, 1 # Lower 32 bits of b
movia r7, 0 # Upper 32-bits of b
call add64 # Result is in r2 and r3
1: br 1b # Done
.global add64
add64:}}
{{HintBox|The difference between regular addition and big-integer addition is that you need to detect the carry-out from the low-order adder and feed that to the high-order adder (much like a ripple-carry adder). Nios II does not have an easy way to detect carry-out from an addition. The method recommended by the ISA reference is to compare the result with one of the operands: If an addition overflows, the addition result is always (unsigned) smaller than both of its operands.}}
{{SubmitBox|arch=nios2}}
2d54ca7e7d11c0d687304d1a342cc1dee1f47a89
Arm/odd
0
25
260
60
2017-02-26T07:06:25Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even. Your algorithm should be O(1) because there is a runtime limit on your function of 10000 instructions.
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
mov r0, #1
bl odd
1: b 1b // Done
.global odd
odd:}}
{{SubmitBox|arch=arm}}
7276244c468c3da4ce6de6d142f0a7db08d4c296
262
260
2017-02-26T07:17:36Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the whether its parameter is odd. Return 1 if odd, 0 if even. Your algorithm's runtime should not grow with the value of <tt>n</tt> because there is a runtime limit on your function of 10000 instructions.
<syntaxhighlight lang="c">int odd (int n);</syntaxhighlight>
{{ExampleBox|1
2|1
0|3=
.global _start
_start:
mov r0, #1
bl odd
1: b 1b // Done
.global odd
odd:}}
{{SubmitBox|arch=arm}}
374591b2cd92ecec312694ba02d0c764d0edbf26
MediaWiki:Sidebar
8
4
264
122
2017-09-28T07:31:00Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* SEARCH
* TOOLBOX
* LANGUAGES
af64e2372f455b2d63560f3a5941b7b4bca6d279
269
264
2017-10-03T21:17:59Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II simulator
** https://cpulator.01xz.net/arm|CPUlator — ARMv7 simulator
* SEARCH
* TOOLBOX
* LANGUAGES
3606bf09508fd766f00ffb148f5d03d881f0212f
Template:SubmitBox
10
15
265
250
2017-09-28T07:38:22Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
btn.disabled = true;
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); this.form.submit();">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
69b1ea5316ebd177a99c781f16843ffa6b58c1e5
275
265
2017-10-04T03:26:52Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Simulate this">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); this.form.submit();">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
55a617743f389f6de00c7b1f881d7cfc92c2bb35
276
275
2017-10-04T03:36:28Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Paste your code here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
return true;
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<h3 style="margin-top:2.5em">Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); this.form.submit();">
</form>
</div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
19a3fdaa5489edb3f20a5d16d66b8a69504f7294
279
276
2017-10-04T23:47:02Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var t = new XMLHttpRequest();t.open("GET", "/soln.php?show\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");t.send();
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "json";
xhr.onload = function() {
if (xhr.response.status == 1) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else if (xhr.response.status == 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox_box').innerHTML = xhr.response.data;
document.getElementById('solnbox').style.display="block";
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box"></textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
c209f07b05efeb6c6d8ef450361f17e0f06adb13
280
279
2017-10-05T19:43:12Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var t = new XMLHttpRequest();t.open("GET", "/soln.php?show\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");t.send();
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "json";
xhr.onload = function() {
if (xhr.response.status == 1) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else if (xhr.response.status == 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox_box').innerHTML = xhr.response.data;
document.getElementById('solnbox').style.display="block";
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box"></textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
0a7df06cca336bea1baddba6cc80c5cf3b75bc09
281
280
2017-10-06T06:39:07Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?show\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "json";
xhr.onload = function() {
editor_soln.setValue(xhr.response.data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "json";
xhr.onload = function() {
if (xhr.response.status == 1) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else if (xhr.response.status == 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
6b4f52ed12719c4e7b060e35fcf071a01b040d09
282
281
2017-10-06T07:22:54Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?show\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
if (r.status == 1) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else if (r.status == 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
e9ff5547705b6c1c2fa8ca13aae12d5d27f043c5
283
282
2017-10-07T05:20:05Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox"">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var problem_is_completed = false;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (problem_is_completed) return;
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?show\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/soln.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
if (r.status == 1) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else if (r.status == 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
0bddea8f97daa182fb14a50ff2d3eb1c95fc24d4
284
283
2017-10-08T02:46:15Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
da1dca2d0acd0ac2d9a2817990bb8ffcc3433937
MediaWiki:Foreground.css
8
5
266
5
2017-10-01T21:01:00Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 1px 0px 6px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
bf45215023571ab9049b5f3a6bda1285b785e17f
267
266
2017-10-01T21:05:27Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
51776f33701a2fe150178a637c83c02d64bbabf4
268
267
2017-10-01T21:31:08Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
72600b26d625852f1e692dab8bd1c069b9ed485a
277
268
2017-10-04T05:43:52Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
df2190bd5d189bfaa0891098b3deb06dd2f91854
278
277
2017-10-04T23:38:29Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
654f81424991c306cc017d03b5ff6711d68fb67d
285
278
2017-10-11T08:29:44Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
div.row.with_menu {
max-width: 83em;
}
/* ProblemMenu */
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
font-family:"FontAwesome";
content: "\f0d7 ";
width: 1em;
dsiplay: inline-block;
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da ";
width: 1em;
dsiplay: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 3em;
font-size: 80%;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
45a9f3cdf760132443bd3d9e9c650f6fd0556e55
287
285
2017-10-11T08:32:37Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
div.row.with_menu {
max-width: 83em;
}
/* ProblemMenu */
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7 ";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da ";
width: 1em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 3em;
font-size: 80%;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
a10886ecef6bb9edda2e077849f277cb63038ef5
288
287
2017-10-11T08:33:57Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
div.row.with_menu {
max-width: 83em;
}
/* ProblemMenu */
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 1em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 3em;
font-size: 80%;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
4ddf546cb82914162178695f565b7c3ab28dadcc
289
288
2017-10-11T08:34:18Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
div.row.with_menu {
max-width: 83em;
}
/* ProblemMenu */
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 3em;
font-size: 80%;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
7fb34282df6dbeaa314611daf655797d3f8ddfc2
290
289
2017-10-11T18:40:03Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding: 0 0.25em;
}
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 3em;
font-size: 80%;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
1616c4d3d2f92dff553dd6c99f2f44df75755c68
291
290
2017-10-11T18:45:12Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 3em;
font-size: 80%;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
c6a76b90d19245f54d0eb275859fddb27d4cdb27
292
291
2017-10-11T19:19:41Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
div#pmenu_menu {
background-color: #f8f8f8;
padding-top: 1.5em;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
background-color: inherit;
padding-top: 0;
}
ul#pmenu_top {
font-size: 80%;
margin-top: 3em;
}
div#pmenu_menu::before {
content: "";
}
}
0fd69724585f830a867c0493ab951d2e07cf4e68
293
292
2017-10-11T19:21:47Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
line-height: 1.4em;
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
margin-top: 3em;
}
div#pmenu_menu::before {
content: "";
}
}
3c0fbdd00057bce65d2d6a5505e9d1c50d5cbf8a
294
293
2017-10-11T19:24:31Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
margin-top: 3em;
}
div#pmenu_menu::before {
content: "";
}
}
b6b1c81bcaa68a92cefead5f5a098bc55c27c6db
295
294
2017-10-11T19:34:13Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Raleway:400,400i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Raleway", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Raleway", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Raleway", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu {
margin-top: 2em;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
}
div#pmenu_menu::before {
content: "";
}
}
94388f20958d2e73b971e498c78341277d10ac69
Project:About
4
43
270
123
2017-10-03T21:18:40Z
Henry
1
wikitext
text/x-wiki
This is an assembly language version of [https://hdlbits.01xz.net/wiki/Project:About HDLBits].
7d510e86ba211e69e3f1508d386121036ea61fd6
Arm/add
0
88
273
2017-10-03T21:42:03Z
Henry
1
Created page with "Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. As always, the first parameter is in <tt>r0</tt> and th..."
wikitext
text/x-wiki
Write a function that returns the sum of its two parameters. The parameters and return values are both 32-bit integers. As always, the first parameter is in <tt>r0</tt> and the second parameter is in <tt>r1</tt>.
<syntaxhighlight lang="c">int add (int a, int b);</syntaxhighlight>
{{ExampleBox|(1, 1)|2 |3=
.global _start
_start:
mov r0, #1 // First function parameter is always passed through r0.
mov r1, #1 // Second function parameter is always passed through r1.
bl add // Return value is always in r0.
1: b 1b // Done
.global add
add:}}
{{SubmitBox|arch=arm}}
1462828dce5438e6439834ee367dd6f83742042a
Arm index
0
19
274
245
2017-10-03T21:46:15Z
Henry
1
/* Arithmetic */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add">Add</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
36fd862b8389cce623bfd4ee1f7f755dbe0359b6
HDLBits:ProblemMenu
3072
89
286
2017-10-11T08:30:40Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
07d625c4a6e4822df5d710fc03b26562333181df
Nios/callparam
0
75
296
238
2017-10-12T22:41:47Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r4</tt> through <tt>r7</tt>. Also don't forget to save <tt>ra</tt>, as a function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
_start:
movia sp, 0x04000000
call call1234
1: br 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
movi r2, 1
ret
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than <tt>call</tt>) to call the function. Because you didn't use call, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call elimination in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=nios2}}
a92402816fdbaea67f6c3f34c750397ad4782bd9
Arm/callparam
0
55
297
176
2017-10-12T22:42:13Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. Also don't forget to save <tt>lr</tt>, as the function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
_start:
bl call1234
1: b 1b
not_secret: # For debugging, call this instead of secret.
# Call "secret" when submitting or you'll get wrong answer!
mov r0, #1
mov pc, lr
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than branch-and-link) to call the function. Because you didn't use branch-and-link, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call optimization in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=arm}}
c9f7c9e43b65b74845fbff1d01b366d2fadab39e
Nios/declword
0
90
298
2017-10-13T22:11:06Z
Henry
1
Created page with "Declare two words of memory, with a label for each one. The word at label <tt>One</tt> should contain the word with value 1, and the word at <tt>Two</tt> should have the value..."
wikitext
text/x-wiki
Declare two words of memory, with a label for each one. The word at label <tt>One</tt> should contain the word with value 1, and the word at <tt>Two</tt> should have the value 2.
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here
}}
{{HintBox|Declarations (creating initialized memory values) is done using assembler directives. The common ones are <tt>.word</tt>, <tt>.hword</tt>, and <tt>.byte</tt>.}}
{{SubmitBox|arch=nios2}}
c88a02be7a1a10606f2b1c11bdbb788030717dab
Nios/declword4
0
91
299
2017-10-13T22:19:29Z
Henry
1
Created page with "Declare four consecutive half-words of memory. The four half-words should have the values 'y', 'z', 0x61, and 98, respectively. Also create a label named <tt>A</tt> that point..."
wikitext
text/x-wiki
Declare four consecutive half-words of memory. The four half-words should have the values 'y', 'z', 0x61, and 98, respectively. Also create a label named <tt>A</tt> that points to the third half-word (0x61). (In other words, there are two half-words before the label A, and two after.)
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|Declarations made consecutively in the code will be consecutive in memory. Each declaration creates an initialized value at the current location of the assembler's output (It's part of the executable, and not similar to malloc().)}}
{{SubmitBox|arch=nios2}}
016eb0385f45edbe2989aa02c4a07b54c22bda9e
Nios/declstring
0
92
300
2017-10-13T22:25:06Z
Henry
1
Created page with "Declare a string at the label <tt>Hello</tt>: "This is a string" This problem only checks for the declaration. There is no code. {{ExampleBox|[No input]|[No output] |3= # In..."
wikitext
text/x-wiki
Declare a string at the label <tt>Hello</tt>: "This is a string"
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|Strings are null-terminated. This is usually handled for you (depending on which directive you use to create the string).)}}
{{SubmitBox|arch=nios2}}
96c5f1470d84bb52c266c7aaeb538525bfd8ed69
Arm/declstrword
0
93
301
2017-10-13T22:38:58Z
Henry
1
Created page with "Starting at label "STUFF', declare the following: <ol><li>A null-terminated string, "Hi",</li> <li>A word with value 0x1234"</li> </ol> Be sure that declarations are properly..."
wikitext
text/x-wiki
Starting at label "STUFF', declare the following:
<ol><li>A null-terminated string, "Hi",</li>
<li>A word with value 0x1234"</li>
</ol>
Be sure that declarations are properly aligned.
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|Strings are arrays of bytes, so they have no alignment requirements. Half-words and words need to be "naturally aligned" (must start at a multiple of their size: 2 or 4 bytes, respectively). The <tt>.align</tt> directive may be useful here.)}}
{{SubmitBox|arch=arm}}
93a09428f13753488d3950bb92383b05f87afd71
Nios/declblob
0
94
302
2017-10-13T22:44:52Z
Henry
1
Created page with "Declare the following 12 bytes starting at label <tt>Blob</tt> (from low address to high address): <tt>Blob: 01 02 03 04 05 06 07 08 09 0a 0b 0c</tt> This problem only check..."
wikitext
text/x-wiki
Declare the following 12 bytes starting at label <tt>Blob</tt> (from low address to high address):
<tt>Blob: 01 02 03 04 05 06 07 08 09 0a 0b 0c</tt>
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|See if you can declare three .words instead of 12 .bytes.}}
{{SubmitBox|arch=nios2}}
b9123f6607cdab82a72dc4d16ecedd9e7eb93356
Nios/declblob2
0
95
303
2017-10-13T23:05:22Z
Henry
1
Created page with "Declare the following 12 bytes (from low address to high address): <tt>01 02 03 04 05 <b>06</b> 07 08 09 0a 0b 0c</tt> Create a label named <tt>Six</tt> that points to the 6..."
wikitext
text/x-wiki
Declare the following 12 bytes (from low address to high address):
<tt>01 02 03 04 05 <b>06</b> 07 08 09 0a 0b 0c</tt>
Create a label named <tt>Six</tt> that points to the 6th byte of the blob. In addition, make sure the label <tt>Six</tt> is at 0x1000 bytes after the beginning of the <tt>.data</tt> section. (This implies that the entire 12 bytes of data need to be moved).
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|The .org directive changes the current output location within the section.}}
{{SubmitBox|arch=nios2}}
b90237e45090b9050abbf528223f16aa36c6b990
Nios/declstruct
0
96
304
2017-10-13T23:12:21Z
Henry
1
Created page with "Consider the following struct: <source lang="c"> struct { char postal_code[7]; unsigned short area_code; };</source> Declare an array of three of these structs starti..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">
struct {
char postal_code[7];
unsigned short area_code;
};</source>
Declare an array of three of these structs starting at location <tt>List</tt>, initialized to the following:
<source lang="c">{ "M5S3G4", 416 }, { "V6T1Z4", 604 }, { "K7L3N6", 613 }</source>
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|Declarations made consecutively in the code will be consecutive in memory. Each declaration creates an initialized value at the current location of the assembler's output (It's part of the executable, and not similar to malloc().)}}
{{SubmitBox|arch=nios2}}
3dbb7df9c2e252ce9e65f75e8a313310a57a4fe5
305
304
2017-10-13T23:12:36Z
Henry
1
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">
struct {
char postal_code[7];
unsigned short area_code;
};</source>
Declare an array of three of these structs starting at location <tt>List</tt>, initialized to the following:
<source lang="c">{ "M5S3G4", 416 }, { "V6T1Z4", 604 }, { "K7L3N6", 613 }</source>
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{SubmitBox|arch=nios2}}
3d51a411dc236e2db30d5e41ce8538ce7a4123a1
File:Declstruct2.png
6
97
306
2017-10-14T08:35:55Z
Henry
1
wikitext
text/x-wiki
da39a3ee5e6b4b0d3255bfef95601890afd80709
Nios/declstruct2
0
98
307
2017-10-14T08:37:22Z
Henry
1
No
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">
struct Node {
Node *c1;
Node *c2;
int name
};</source>
Each Node has a name, and can point to up to two other Nodes. A set of these Nodes can be used to represent a tree or a graph (with up to two outgoing edges per node).
Declare five instances of Node to represent the following 5-node binary tree. The node names are labelled in each box. If a node's outgoing edge is unused, initialize the pointer to 0. Label the root node (named 0) with the label <tt>Root</tt>.
[[File:Declstruct2.png]]
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{SubmitBox|arch=nios2}}
b038b9d984f4ee7afaac1836b1e27bf67da1ce57
Nios/declequ
0
99
308
2017-10-15T04:34:19Z
Henry
1
Created page with "The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers. Using <tt>.equ</tt>, declare a co..."
wikitext
text/x-wiki
The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers.
Using <tt>.equ</tt>, declare a constant named LEDS with value 0xff200000 (This is the location of the LED I/O device). Then write a function named <tt>get_led</tt> that returns the value of LEDs in r2. (This is just a <tt>movia</tt> to practice using the constant.)
{{ExampleBox|[No input]|2=r2=0xff200000 |3=
# Insert declarations here
.global get_led
# A function that returns the value of LEDS
get_led:
}}
{{SubmitBox|arch=nios2}}
b6a703990246ee8d96483f0ef011ceafcc8422df
Nios/declequ2
0
100
309
2017-10-15T04:43:45Z
Henry
1
Created page with "In this problem, the constant <tt>STARTVAL</tt> has been declared (and declared as .global so you can use it). Declare 4 words beginning at label <tt>Nums</tt>, with values..."
wikitext
text/x-wiki
In this problem, the constant <tt>STARTVAL</tt> has been declared (and declared as .global so you can use it).
Declare 4 words beginning at label <tt>Nums</tt>, with values STARTVAL, STARTVAL+1, ... , STARTVAL+3.
{{ExampleBox|[No input]|[No output]|3=
# Insert declarations here}}
{{SubmitBox|arch=nios2}}
641eb72f13a63ee0a26d158a633078c480b97614
Nios/signext
0
101
310
2017-10-15T04:55:36Z
Henry
1
Created page with "Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input..."
wikitext
text/x-wiki
Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
{{ExampleBox|0xf0|0xfffffff0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 0xf0 # First parameter is always in r4
call signext
br _start # End of testing code
# A function to sign extend. Only this part will be tested.
signext:
}}
{{SubmitBox|arch=nios2}}
e2b56ee3326bb87e618f6909192cb7560c47a715
Nios/zeroext
0
102
311
2017-10-15T04:58:28Z
Henry
1
Created page with "Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input..."
wikitext
text/x-wiki
Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
{{ExampleBox|0xf0|0x000000f0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 0xf0 # First parameter is always in r4
call zeroext
br _start # End of testing code
# A function to zero extend. Only this part will be tested.
zeroext:
}}
{{SubmitBox|arch=nios2}}
94447c84dc0651c4e51ab8b0c52f82027b9eb22d
Nios/extend
0
103
312
2017-10-15T05:33:57Z
Henry
1
Created page with "Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r2). The first function parameter (in r4) specifies which oper..."
wikitext
text/x-wiki
Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r2). The first function parameter (in r4) specifies which operation to do, while the second parameter holds the number to extend:
<ul><li>r4 = 0: Zero extend 8 bit to 32 bit</li>
<li>r4 = 1: Zero extend 16 bit to 32 bit</li>
<li>r4 = 2: Sign extend 8 bit to 32 bit</li>
<li>r4 = 3: Sign extend 16 bit to 32 bit</li>
</ul>
{{ExampleBox|extend(2,0xf0)|0xfffffff0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 2 # 2 = sign extend 8->32
movi r5, 0xf0 # The number to extend
call extend
br _start # End of testing code
# A function to extend. Only this part will be tested.
extend:
}}
{{SubmitBox|arch=nios2}}
7969d900b3c476fded9afd6ed37acf3a79968527
313
312
2017-10-15T05:34:25Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r2). The first function parameter (in r4) specifies which operation to do, while the second parameter holds the number to extend:
<ul><li>r4 = 0: Zero extend 8 bit to 32 bit</li>
<li>r4 = 1: Zero extend 16 bit to 32 bit</li>
<li>r4 = 2: Sign extend 8 bit to 32 bit</li>
<li>r4 = 3: Sign extend 16 bit to 32 bit</li>
</ul>
{{ExampleBox|extend(2,0xf0)|2=r2=0xfffffff0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 2 # 2 = sign extend 8->32
movi r5, 0xf0 # The number to extend
call extend
br _start # End of testing code
# A function to extend. Only this part will be tested.
extend:
}}
{{SubmitBox|arch=nios2}}
eb691ff6f971954fab43fd1e76eeef7a5cacdfad
Nios/saturate
0
104
314
2017-10-15T05:43:26Z
Henry
1
Created page with "Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around. Write a function that wil..."
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around.
Write a function that will convert an unsigned 32-bit number to 16 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the maximum possible unsigned 16-bit value.
{{ExampleBox|0x12345|0xffff|3=
# A test case to test your function with
.global _start
_start:
movi r4, 0x12345 # First parameter is always in r4
call saturate
br _start # End of testing code
# Convert unsigned 32 bit to 16 bit, with saturation
saturate:
}}
{{SubmitBox|arch=nios2}}
d08f6165124a2b1ba4c617e44e0c520e14d7ecdb
315
314
2017-10-15T05:43:41Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around.
Write a function that will convert an unsigned 32-bit number to 16 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the maximum possible unsigned 16-bit value.
{{ExampleBox|0x12345|0xffff|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x12345 # First parameter is always in r4
call saturate
br _start # End of testing code
# Convert unsigned 32 bit to 16 bit, with saturation
saturate:
}}
{{SubmitBox|arch=nios2}}
33258d8eee351731928921b7b9d84d10c3ca1fe0
Nios/saturate2
0
105
316
2017-10-15T05:53:32Z
Henry
1
Created page with "Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around. Write a functio..."
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around.
Write a function that will convert a signed 32-bit number to (signed) 8 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the closest possible signed 8-bit value.
{{ExampleBox|0x123|0x7f|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x123 # First parameter is always in r4
call saturate
br _start # End of testing code
# Convert signed 32 bit to 8 bit, with saturation
saturate:
}}
{{SubmitBox|arch=nios2}}
88d41e9a82f1592d4b512d1b734500fc7c450d7c
317
316
2017-10-15T05:55:26Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around.
Write a function that will convert a signed 32-bit number to (signed) 8 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the closest possible signed 8-bit value. Since the output is an 8 bit value, the upper 24 bits of the return value should be zero.
{{ExampleBox|0x123|0x7f|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x123 # First parameter is always in r4
call saturate
br _start # End of testing code
# Convert signed 32 bit to 8 bit, with saturation
saturate:
}}
{{SubmitBox|arch=nios2}}
7e29013aaf68e4525299cb74a20c467a3c7d4f0f
Nios/bcd2
0
106
318
2017-10-15T06:16:24Z
Henry
1
Created page with "Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represen..."
wikitext
text/x-wiki
Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represent one decimal digit (of values 0 to 9). Thus, the number 10 (or 0xa) is encoded in BCD as 0x10.
Write a function that converts a number into its BCD representation. You are guaranteed that the input number will be between 0 and 15.
{{ExampleBox|10|0x10|3=
# A test case to test your function with
.global _start
_start:
movia r4, 10 # First parameter is always in r4
call bcd
br _start # End of testing code
# Convert a number to BCD representation
bcd:
}}
{{SubmitBox|arch=nios2}}
ca50625126d79dbfdd9e0d9c934237a2355e34e4
Nios/bcd8
0
107
319
2017-10-15T06:17:17Z
Henry
1
Created page with "Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represen..."
wikitext
text/x-wiki
Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represent one decimal digit (of values 0 to 9).
Write a function that converts a number into its BCD representation. You are guaranteed that the input number will be between 0 and 99999999.
{{ExampleBox|10|0x10|3=
# A test case to test your function with
.global _start
_start:
movia r4, 10 # First parameter is always in r4
call bcd
br _start # End of testing code
# Convert a number to BCD representation
bcd:
}}
{{SubmitBox|arch=nios2}}
e1bbc9ef2a8020005951673da75255fcc090a37a
Nios/hex1
0
108
320
2017-10-15T18:41:13Z
Henry
1
Created page with "Write a function that converts a one-digit hexadecimal number (0 to 15) into an ASCII character suitable for printing the number. For 0xa through 0xf, use lower-case ('a' thro..."
wikitext
text/x-wiki
Write a function that converts a one-digit hexadecimal number (0 to 15) into an ASCII character suitable for printing the number. For 0xa through 0xf, use lower-case ('a' through 'f'). You are guaranteed that the input number will be between 0 and 15.
{{ExampleBox|0xa|'a'|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0xa # First parameter is always in r4
call hex1
br _start # End of testing code
# Print one hex digit
hex1:
}}
{{SubmitBox|arch=nios2}}
df3783ee548330ed6231c9af5573378369afc345
Nios/hexstr
0
109
321
2017-10-15T19:15:14Z
Henry
1
Created page with "Write a function that converts a 32-bit hexadecimal number into an ASCII character string. For digits 0xa through 0xf, use lower-case ('a' through 'f'). Don't include any lead..."
wikitext
text/x-wiki
Write a function that converts a 32-bit hexadecimal number into an ASCII character string. For digits 0xa through 0xf, use lower-case ('a' through 'f'). Don't include any leading zeros, but always output at least one digit (so 0x00001000 should print "1000", and 0x00000000 should output "0"). Make sure the string is null-terminated.
There are two parameters to your function. The first parameter is the location to where you should write the output string. The second parameter is the number to process.
{{ExampleBox|0x12345678|"12345678"|3=
# A test case to test your function with
MyString: .skip 12 # Reserve some space to hold the output string
.global _start
_start:
movia r4, MyString # First parameter: Where to write
movia r5, 0x12345678 # Second parameter: The number to process
call hexstr
br _start # End of testing code
# Convert number to string
hexstr:
}}
{{SubmitBox|arch=nios2}}
eeebc0971500eb3298cd2a3ee53a0f9d2fbb4d59
Nios/decstr1
0
110
322
2017-10-15T19:56:08Z
Henry
1
Created page with "Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The number is guaranteed to fit within an unsigned..."
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The number is guaranteed to fit within an unsigned 32-bit number.
{{ExampleBox|"1000"|2=r2=1234 (or 0x4d2)|3=
# A test case to test your function with
Str: .string "1234"
.global _start
_start:
movia r4, Str
call decstr
br _start # End of testing code
# Parse a decimal string
decstr:
}}
{{SubmitBox|arch=nios2}}
a6200028e9fb279d84d3f7cfe064a3d7d5f332ad
Nios/decstr2
0
111
323
2017-10-15T20:07:13Z
Henry
1
Created page with "Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negativ..."
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negative number, and the remaining characters are decimal digits. The number is guaranteed to fit within an signed 32-bit number.
{{ExampleBox|"1000"|2=r2=1234 (or 0x4d2)|3=
# A test case to test your function with
Str: .string "1234"
.global _start
_start:
movia r4, Str
call decstr
br _start # End of testing code
# Parse a decimal string
decstr:
}}
{{SubmitBox|arch=nios2}}
b3318c42083d77fd5047e9074f6fd979364198f4
Nios/maxu
0
112
324
2017-10-15T20:36:06Z
Henry
1
Created page with "Write a function that returns the maximum value out of an array of 32-bit unsigned words. The function has two parameters. The first parameter is the length of the array (at..."
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 32-bit unsigned words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r2=3|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call max
br _start # End of testing code
# Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=nios2}}
117a4873fbfa5fe18a1b0b2da14896fe2bd145b3
Nios/mins
0
113
325
2017-10-15T20:49:13Z
Henry
1
Created page with "Write a function that returns the minimum value out of an array of 32-bit signed words. The function has two parameters. The first parameter is the length of the array (at le..."
wikitext
text/x-wiki
Write a function that returns the minimum value out of an array of 32-bit signed words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r2=1|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call min
br _start # End of testing code
# Return minimum element of signed array
min:
}}
{{SubmitBox|arch=nios2}}
a4a403f1958b488a953173b0ca638fc165a7ae83
Nios/maxs8
0
114
326
2017-10-15T21:12:02Z
Henry
1
Created page with "Write a function that returns the maximum value out of an array of 8-bit signed bytes. The function has two parameters. The first parameter is the length of the array (at lea..."
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 8-bit signed bytes.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r2=3|3=
# A test case to test your function with
Array: .byte 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call max
br _start # End of testing code
# Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=nios2}}
8fb9fd02e50ca7ee47cc6938c7eb63649f766b3c
Nios/bswap
0
115
327
2017-10-15T21:19:05Z
Henry
1
Created page with "When communicating multi-byte (hword or word) values between machines of different endianness, it is sometimes necessary to swap the byte ordering. Write a function that will..."
wikitext
text/x-wiki
When communicating multi-byte (hword or word) values between machines of different endianness, it is sometimes necessary to swap the byte ordering. Write a function that will reverse the byte ordering in a 32-bit word. (Note that only bytes are swapped. The 8 bits within each byte are still in the same order.)
The function has one parameter: The input number.
{{ExampleBox|0x11223344|2=r2=0x44332211|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x11223344
call bswap
br _start # End of testing code
# Byte swap
bswap:
}}
{{SubmitBox|arch=nios2}}
871cdb98fbab8b2697536355c543ad1470d57f0a
Nios/bits1
0
116
328
2017-10-15T21:45:32Z
Henry
1
Created page with "An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given num..."
wikitext
text/x-wiki
An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given number, in unsigned binary representation.
{{ExampleBox|0x1000|2=r2=13|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x1000
call bits
br _start # End of testing code
# Return minimum number of bits to represent first parameter
bits:
}}
{{SubmitBox|arch=nios2}}
4840c6a0e527b5cbe55e5cd3a39923baee7c5544
Nios/bits2
0
117
329
2017-10-15T22:15:47Z
Henry
1
Created page with "A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits..."
wikitext
text/x-wiki
A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits are needed to represent a given number, in signed binary representation.
{{ExampleBox|0x1000|2=r2=13|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x1000
call bits
br _start # End of testing code
# Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|Think carefully about corner cases...}}
{{SubmitBox|arch=nios2}}
e255c53c3a6686521b47928ded45962d8c022a5b
Nios/shiftu
0
118
330
2017-10-15T23:27:09Z
Henry
1
Created page with "One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the..."
wikitext
text/x-wiki
One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the information about the audio sample.
For this problem, write a function (named shift) that converts one unsigned 32-bit audio sample to unsigned 8-bit format, and returns the converted sample. As a result, the least-significant 24 bits of the sample are lost (truncation). Don't do any rounding.
{{ExampleBox|0x12345678|2=0x12|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x12345678
call shift
br _start # End of testing code
# Convert one U32 sample to U8 format
shift:
}}
{{SubmitBox|arch=nios2}}
27c6d50534be49a6463c4f96d0ad9061944ce69b
Nios/shifts
0
119
331
2017-10-15T23:38:56Z
Henry
1
Created page with "One common case where you need to shift and truncate numbers is when changing the amplitude of audio samples. For this problem, write a function (named shift) that will accep..."
wikitext
text/x-wiki
One common case where you need to shift and truncate numbers is when changing the amplitude of audio samples.
For this problem, write a function (named shift) that will accept a 32-bit signed audio sample, and return a 32-bit signed audio sample with 1/4 of the amplitude. Don't do any rounding (just shift and truncate).
{{ExampleBox|0x40000|2=0x10000|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x40000
call shift
br _start # End of testing code
# Return 1/4 amplitude for a S32 sample
shift:
}}
{{SubmitBox|arch=nios2}}
17277eecdfa739252032e138ac41fb24fd999bd4
Nios/shiftl
0
120
332
2017-10-16T02:30:34Z
Henry
1
Created page with "One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the..."
wikitext
text/x-wiki
One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the information about the audio sample.
For this problem, write a function (named shift) that converts one signed 16-bit audio sample to signed 32-bit format, and returns the converted sample. (This is equivalent to increasing the amplitude by 65536 times.) As a result of the conversion, the low 16 bits of the result become zero.
{{ExampleBox|0x1234|2=0x12340000|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x1234
call shift
br _start # End of testing code
# Convert one S16 to S32 format
shift:
}}
{{SubmitBox|arch=nios2}}
318057fbd14409be1779a41ba9e87b50fd607390
Nios/normalize
0
121
333
2017-10-16T03:55:43Z
Henry
1
Created page with "Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then..."
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r4: The number of elements in the input (and output) array</li>
<li>r5: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r6: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
<vlgstat tc="nios/maxu"/> and <vlgstat tc="nios/bits1"/>
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
# A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
movia r4, 4
movia r5, Input
movia r6, Output
call normalize
br _start # End of testing code
# Normalize to U16
normalize:
}}
{{SubmitBox|arch=nios2}}
027ef7a31f1dee0e15a70a34fc4d0c66f87d5174
334
333
2017-10-16T03:56:06Z
Henry
1
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r4: The number of elements in the input (and output) array</li>
<li>r5: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r6: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
You may wish to reuse your solutions to <vlgstat tc="nios/maxu"/> and <vlgstat tc="nios/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
# A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
movia r4, 4
movia r5, Input
movia r6, Output
call normalize
br _start # End of testing code
# Normalize to U16
normalize:
}}
{{SubmitBox|arch=nios2}}
554fb94045df410a15f72e11245001a90418954e
335
334
2017-10-16T03:56:21Z
Henry
1
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r4: The number of elements in the input (and output) array</li>
<li>r5: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r6: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
You may wish to reuse your solutions to <vlgstat tc="nios/maxu"/> and <vlgstat tc="nios/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
# A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
movia r4, 4
movia r5, Input
movia r6, Output
call normalize
br _start # End of testing code
# Normalize to U16
normalize:
}}
{{SubmitBox|arch=nios2}}
3ee48c3e59ba27701398e1359f34f828c3f16516
Nios/peak
0
122
336
2017-10-16T04:13:46Z
Henry
1
Created page with "Write a function that returns the peak-to-peak amplitude of an array of 32-bit signed words. This is the difference between the maximum and minimum samples. The function has..."
wikitext
text/x-wiki
Write a function that returns the peak-to-peak amplitude of an array of 32-bit signed words. This is the difference between the maximum and minimum samples.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r2=2|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call peak
br _start # End of testing code
# Return the difference between max and min array elements
peak:
}}
{{SubmitBox|arch=nios2}}
7b4e8b24d349540f707825f8f1e591fae0a6e511
Nios/arraysum
0
123
337
2017-10-16T04:37:38Z
Henry
1
Created page with "Write a function that returns the sum of all elements of an array of 32-bit (signed) words. The function has two parameters. The first parameter is a pointer to the start of..."
wikitext
text/x-wiki
Write a function that returns the sum of all elements of an array of 32-bit (signed) words.
The function has two parameters. The first parameter is a pointer to the start of the array. The second parameter is the length of the array (at least 1).
{{ExampleBox|[1, 2, 3]|2=r2=6|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, Array
movia r5, 3
call arraysum
br _start # End of testing code
# Sum elements of array
arraysum:
}}
{{SubmitBox|arch=nios2}}
41ce953daa59bd09294180ec0d4a02f8a4a480a9
Nios/subarraysum
0
124
338
2017-10-16T05:23:13Z
Henry
1
Created page with "The maximum subarray sum algorithm returns the biggest sum of the elements of any subarray of a given array. A subarray consists of consecutive elements of an array (a subarra..."
wikitext
text/x-wiki
The maximum subarray sum algorithm returns the biggest sum of the elements of any subarray of a given array. A subarray consists of consecutive elements of an array (a subarray is not the same as a subsequence).
For example, consider the following array:
<tt>[ -1, -1, <b>3, -1, 3</b>, -2 ]</tt>
There are many subarrays of this array. A subarray may include the entire array. A subarray cannot be empty. In this example, the subarray that gives the largest sum is [3, -1, 3] (3rd through 5th elements), with a sum of 5.
Write a function that returns the maximum subarray sum for a given array of 32-bit signed words. (This problem doesn't make sense with unsigned words, because if all elements were non-negative, you'd always include all of them to get the biggest sum.)
The function has two parameters. The first parameter is a pointer to the start of the array. The second parameter is the length of the array (at least 1).
You may wish to reuse your solution from <vlgstat tc="nios/arraysum"/>. A O(n^3) solution is acceptable here.
{{ExampleBox|[-1, -1, 3, -1, 3, -2]|2=r2=5|3=
# A test case to test your function with
Array: .word -1, -1, 3, -1, 3, -2
.global _start
_start:
movia r4, Array
movia r5, 6
call subarraysum
br _start # End of testing code
# Sum elements of array
subarraysum:
}}
{{SubmitBox|arch=nios2}}
0d226e08c0d2c1202fe09f899f4c739979247150
339
338
2017-10-16T05:25:06Z
Henry
1
wikitext
text/x-wiki
The maximum subarray sum algorithm returns the biggest sum of the elements of any subarray of a given array. A subarray consists of consecutive elements of an array (a subarray is not the same as a subsequence).
For example, consider the following array:
<tt>[ -1, -1, <b>3, -1, 3</b>, -2 ]</tt>
There are many subarrays of this array. A subarray may include the entire array. A subarray cannot be empty. In this example, the subarray that gives the largest sum is [3, -1, 3] (3rd through 5th elements), with a sum of 5.
Write a function that returns the maximum subarray sum for a given array of 32-bit signed words. (This problem doesn't make sense with unsigned words, because if all elements were non-negative, you'd always include all of them to get the biggest sum.)
The function has two parameters. The first parameter is a pointer to the start of the array. The second parameter is the length of the array (at least 1).
You may wish to reuse your solution from <vlgstat tc="nios/arraysum"/>. A O(n<sup>3</sup>) solution is acceptable here. O(n<sup>2</sup>) isn't difficult, and O(n) is possible.
{{ExampleBox|[-1, -1, 3, -1, 3, -2]|2=r2=5|3=
# A test case to test your function with
Array: .word -1, -1, 3, -1, 3, -2
.global _start
_start:
movia r4, Array
movia r5, 6
call subarraysum
br _start # End of testing code
# Sum elements of array
subarraysum:
}}
{{SubmitBox|arch=nios2}}
826485fcf607a946a48bcee0a23701e39d31ce70
340
339
2017-10-16T05:25:20Z
Henry
1
wikitext
text/x-wiki
The maximum subarray sum algorithm returns the biggest sum of the elements of any subarray of a given array. A subarray consists of consecutive elements of an array (a subarray is not the same as a subsequence).
For example, consider the following array:
<tt>[ -1, -1, <b>3, -1, 3</b>, -2 ]</tt>
There are many subarrays of this array. A subarray may include the entire array. A subarray cannot be empty. In this example, the subarray that gives the largest sum is [3, -1, 3] (3rd through 5th elements), with a sum of 5.
Write a function that returns the maximum subarray sum for a given array of 32-bit signed words. (This problem doesn't make sense with unsigned words, because if all elements were non-negative, you'd always include all of them to get the biggest sum.)
The function has two parameters. The first parameter is a pointer to the start of the array. The second parameter is the length of the array (at least 1).
You may wish to reuse your solution from <vlgstat tc="nios/arraysum"/>. A O(n<sup>3</sup>) solution is acceptable here. O(n<sup>2</sup>) isn't difficult, and O(n) is possible.
{{ExampleBox|[-1, -1, 3, -1, 3, -2]|2=r2=5|3=
# A test case to test your function with
Array: .word -1, -1, 3, -1, 3, -2
.global _start
_start:
movia r4, Array
movia r5, 6
call subarraysum
br _start # End of testing code
# Sum elements of array
subarraysum:
}}
{{SubmitBox|arch=nios2}}
96488039da2ba491a7712ef0b81c568a387eae1b
Nios/load0
0
125
341
2017-10-16T06:10:36Z
Henry
1
Created page with "There is a 32-bit word located at memory location labelled with the label <tt>Data</tt>. Write a function that reads this word from memory and returns it. Note that the functi..."
wikitext
text/x-wiki
There is a 32-bit word located at memory location labelled with the label <tt>Data</tt>. Write a function that reads this word from memory and returns it. Note that the function has no parameters.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox|No input to function.
|2=r2=123|3=
TestData: .word 123
.global _start
_start:
call load
1: br 1b # Done
load:}}
{{SubmitBox|arch=nios2}}
2f32f45170c851d2a69f1d445cfb94230473a7f2
342
341
2017-10-16T06:11:10Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location labelled with the label <tt>Data</tt>. Write a function that reads this word from memory and returns it. Note that the function has no parameters.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox|No input to function.
|2=r2=0x123|3=
TestData: .word 0x123
.global _start
_start:
call load
1: br 1b # Done
load:}}
{{SubmitBox|arch=nios2}}
149205c18ef0af86c13523c70964f81ff164dd2c
Nios/load1
0
126
343
2017-10-16T06:20:00Z
Henry
1
Created page with "Your function will be passed a pointer to a 32-bit word. Write a function that reads this word from memory and returns it. <syntaxhighlight lang="c">int load (int *pointer);<..."
wikitext
text/x-wiki
Your function will be passed a pointer to a 32-bit word. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer);</syntaxhighlight>
{{ExampleBox|1=r4 = Data
|2=r2=0x123|3=
Data: .word 0x123
.global _start
_start:
movia r4, Data
call load
1: br 1b # Done
# Dereference a pointer
load:}}
{{SubmitBox|arch=nios2}}
c07e5e3fdd3f856cc1c51acbacd77933d5cd6969
Nios/load2
0
127
344
2017-10-16T06:30:47Z
Henry
1
Created page with "Your function will be passed a pointer to the start of an array of 32-bit words, and an array index. Write a function that reads the index<sup>th</sup> word from memory and re..."
wikitext
text/x-wiki
Your function will be passed a pointer to the start of an array of 32-bit words, and an array index. Write a function that reads the index<sup>th</sup> word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer, int index);</syntaxhighlight>
{{ExampleBox|1=r4=Data, r5=1
|2=r2=0x124|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
movia r4, Data
movi r5, 1
call load
1: br 1b # Done
# Dereference a pointer
load:}}
{{SubmitBox|arch=nios2}}
1e7ef524a8f5af98ce323b566f1965134c14550e
Nios/swap
0
128
345
2017-10-16T07:05:59Z
Henry
1
Created page with "Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third p..."
wikitext
text/x-wiki
Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third parameters are indexes to specify which pair of elements of the array should be swapped.
<syntaxhighlight lang="c">int load (int *pointer, int index1, int index2);</syntaxhighlight>
{{ExampleBox|1=r4=Data, r5=0, r6=2
||3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
movia r4, Data
movi r5, 0
movi r6, 2
call swap
1: br 1b # Done
# Swap two array elements
swap:}}
{{SubmitBox|arch=nios2}}
990a6a826b6ec93bb6bd4e633841c486c7960ac9
346
345
2017-10-16T07:06:40Z
Henry
1
wikitext
text/x-wiki
Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third parameters are indexes to specify which pair of elements of the array should be swapped.
<syntaxhighlight lang="c">int load (int *pointer, int index1, int index2);</syntaxhighlight>
{{ExampleBox|1=r4=Data, r5=0, r6=2
|2=[Two array elements swapped]|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
movia r4, Data
movi r5, 0
movi r6, 2
call swap
1: br 1b # Done
# Swap two array elements
swap:}}
{{SubmitBox|arch=nios2}}
9f711b683520997605b43755095373be67f47445
347
346
2017-10-16T07:21:56Z
Henry
1
wikitext
text/x-wiki
Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third parameters are indexes to specify which pair of elements of the array should be swapped.
<syntaxhighlight lang="c">int swap (int *pointer, int index1, int index2);</syntaxhighlight>
{{ExampleBox|1=r4=Data, r5=0, r6=2
|2=[Two array elements swapped]|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
movia r4, Data
movi r5, 0
movi r6, 2
call swap
1: br 1b # Done
# Swap two array elements
swap:}}
{{SubmitBox|arch=nios2}}
57d9275df8c5443e89a2afdf34876f748eec80dd
Nios/chrcpy
0
129
348
2017-10-16T07:33:20Z
Henry
1
Created page with "Write a function that will copy one character from a string to a second string. Your function will be passed four parameters: The first two parameters specify the source strin..."
wikitext
text/x-wiki
Write a function that will copy one character from a string to a second string. Your function will be passed four parameters: The first two parameters specify the source string and character position. The third and fourth parameters specify the destination string and character position. Copy the character. (Don't consider null-termination, overflows, etc.)
<syntaxhighlight lang="c">int chrcpy (char *src, int src_pos, char *dst, int dst_pos);</syntaxhighlight>
{{ExampleBox|chrcpy("hello", 1, "bye", 1)|
|2="bye" -> "bee"|3=
Src: .string "hello"
.align 2 # Insert padding so it's easier to read.
Dst: .string "bye"
.global _start
_start:
movia r4, Src
movi r5, 1
movia r6, Dst
movi r6, 1
call chrcpy
1: br 1b # Done
# Copy a character from one string to another
chrcpy:}}
{{SubmitBox|arch=nios2}}
7700e870bb0bb992df3752cafae74909b26082c4
Nios/loaddecl1
0
130
349
2017-10-16T23:32:44Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="gas">movia r5, Data ldw r2, 4(r5) ldhu r3, 8(r5) ldbu r4, 11(r5) </syntaxhighlight> Declare some data in me..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">movia r5, Data
ldw r2, 4(r5)
ldhu r3, 8(r5)
ldbu r4, 11(r5)
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul><li>r2 = 0x1234</li>
<li>r3 = 0x5678</li>
<li>r4 = 0x90</li></ul>
{{ExampleBox|[None]|2=r2=0x1234, r3=0x5678, r4=0x90 |3=
# Declare something
Data:
.global _start
_start:
movia r5, Data
ldw r2, 4(r5)
ldhu r3, 8(r5)
ldbu r4, 11(r5)
1: br 1b # Done
}}
{{SubmitBox|arch=nios2}}
02b9e81f8a4b85fe195451459c8c0118c0b6971d
Nios/loaddecl2
0
131
350
2017-10-16T23:50:36Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="gas">movia r2, Data ldw r3, 0(r2) add r2, r2, r3 ldw r3, 0(r2) add r2, r2, r3 ldw r4, 0(r2) </syntaxhighlight>..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">movia r2, Data
ldw r3, 0(r2)
add r2, r2, r3
ldw r3, 0(r2)
add r2, r2, r3
ldw r4, 0(r2)
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r4 = 0x1234</li></ul>
{{ExampleBox|[None]|2=r4=0x1234 |3=
# Declare something
.global _start
_start:
movia r2, Data
ldw r3, 0(r2)
add r2, r2, r3
ldw r3, 0(r2)
add r2, r2, r3
ldw r4, 0(r2)
1: br 1b # Done
}}
{{SubmitBox|arch=nios2}}
2020dbe5d5e158dbe0444ffc2ab95aa214bc64ee
Nios/loaddecl3
0
132
351
2017-10-17T02:39:04Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="gas">movia r2, Data ldw r3, 0(r2) ldw r4, 0(r3) ldw r5, 0(r4) </syntaxhighlight> Declare some data in memory..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">movia r2, Data
ldw r3, 0(r2)
ldw r4, 0(r3)
ldw r5, 0(r4)
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r5 = 0x12345</li>
<li>r2, r3, and r4 are all different</li></ul>
{{ExampleBox|[None]|2=r5=0x12345 |3=
# Declare something
.global _start
_start:
movia r2, Data
ldw r3, 0(r2)
ldw r4, 0(r3)
ldw r5, 0(r4)
1: br 1b # Done
}}
{{SubmitBox|arch=nios2}}
503417536031f94f6b30d5e45cca613dad8f34a0
Nios/loaddecl4
0
133
352
2017-10-17T02:51:22Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="gas">movia r2, Data ldw r3, 0(r2) ldw r4, 1(r3) ldw r5, 2(r4) </syntaxhighlight> Declare some data in memory..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">movia r2, Data
ldw r3, 0(r2)
ldw r4, 1(r3)
ldw r5, 2(r4)
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r5 equals r2</li>
<li>r2, r3, and r4 are all different</li></ul>
{{ExampleBox|[None]|2=r2=r5 |3=
# Declare something
.global _start
_start:
movia r2, Data
ldw r3, 0(r2)
ldw r4, 1(r3)
ldw r5, 2(r4)
1: br 1b # Done
}}
{{SubmitBox|arch=nios2}}
eb4b5b0950a49a1ebd06390cca011fa4ef551809
Nios/arrayinsert
0
134
353
2017-10-17T04:24:32Z
Henry
1
Created page with "Write a function that inserts a new element into an array of 32-bit integers. The elements after the insertion position should be moved by one position (expanding the array by..."
wikitext
text/x-wiki
Write a function that inserts a new element into an array of 32-bit integers. The elements after the insertion position should be moved by one position (expanding the array by one).
The first argument is a pointer to the start of the array. The second argument is the number of elements in the array. The third argument indicates where to insert the new element. The fourth argument is the number to insert.
There is no return value.
<syntaxhighlight lang="c">void array_insert (int *array, unsigned int length, unsigned int insert_at, int num);</syntaxhighlight>
''insert_at'' is guaranteed to be no greater than ''length'' (No insertion past the end of the array)
{{ExampleBox|[1 2 3 4], 2, 123 |2=[1 2 123 3 4] | 3=
.data
# Leave some space for the expanded array
Array: .word 1, 2, 3, 4, 0xff, 0xff
.text
.global _start
_start:
movia r4, Array
movia r5, 4
movia r6, 2
movia r7, 123
call array_insert
1: br 1b # Done
array_insert:}}
{{SubmitBox|arch=nios2}}
2c53f2c00ffcf4cd1bbc78d234b37562cc10157a
354
353
2017-10-17T04:25:00Z
Henry
1
wikitext
text/x-wiki
Write a function that inserts a new element into an array of 32-bit integers. The elements after the insertion position should be moved by one position (expanding the array by one).
The first argument is a pointer to the start of the array. The second argument is the number of elements in the array. The third argument indicates where to insert the new element. The fourth argument is the number to insert.
There is no return value.
<syntaxhighlight lang="c">void array_insert (int *array, unsigned int length, unsigned int insert_at, int num);</syntaxhighlight>
'''insert_at''' is guaranteed to be no greater than '''length''' (No insertion past the end of the array)
{{ExampleBox|[1 2 3 4], 2, 123 |2=[1 2 123 3 4] | 3=
.data
# Leave some space for the expanded array
Array: .word 1, 2, 3, 4, 0xff, 0xff
.text
.global _start
_start:
movia r4, Array
movia r5, 4
movia r6, 2
movia r7, 123
call array_insert
1: br 1b # Done
array_insert:}}
{{SubmitBox|arch=nios2}}
d497b5d6ae3e9c7e9cb14d250d4246690094bd14
Nios/tiling
0
135
355
2017-10-17T06:35:44Z
Henry
1
Created page with "You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''..."
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed, given '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are 32-bit unsigned integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9x8 rectangle, 3x2 tiles|r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{SubmitBox|arch=nios2}}
ad010b2c44668cdfd00be7245b5e6587fd8acb32
356
355
2017-10-17T06:36:15Z
Henry
1
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed, given '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are 32-bit unsigned integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9x8 rectangle, 3x2 tiles|2=r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{SubmitBox|arch=nios2}}
2d43ef3e3664b43f781100183465bef22e58fabf
357
356
2017-10-17T06:38:18Z
Henry
1
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed. The function has four parameters: '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are 32-bit unsigned integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9x8 rectangle, 3x2 tiles|2=r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{SubmitBox|arch=nios2}}
18e740075070e49d785c9fffc2abbc6e467af4ae
358
357
2017-10-17T06:53:26Z
Henry
1
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed. The function has four parameters: '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are 32-bit unsigned integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9 × 8 rectangle, 3 × 2 tiles|2=r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{SubmitBox|arch=nios2}}
c9e69c58644757f2020d67da461eaf55065bfdd3
Nios/memtiling
0
136
359
2017-10-17T06:55:14Z
Henry
1
Created page with "You need to create a memory of depth '''d''' and width '''w''' bits. But all you have are memory chips of depth '''d2''' and width '''w2''' bits. How many memory chips do you..."
wikitext
text/x-wiki
You need to create a memory of depth '''d''' and width '''w''' bits. But all you have are memory chips of depth '''d2''' and width '''w2''' bits. How many memory chips do you need to make the '''d''' × '''w''' memory?
Write a function that computes the number of rows and columns of memory chips needed. The function has four parameters: '''d''', '''w''', '''d2''', and '''w2'''. Return the number of rows (i.e., depth) in r2, and the number of columns (width) in r3.
The four input parameters are 32-bit unsigned integers. '''d2''' and '''w2''' are guaranteed to not be zero.
{{ExampleBox|262144 × 32 memory, 65536 × 16 chips|2=r2=4, r3=2|3=
.global _start
_start:
movia r4, 262144
movia r5, 32
movia r6, 65536
movia r7, 16
call tile
1: br 1b # Done
tile:}}
{{HintBox|See also: <vlgstat tc="nios/tiling"/>}}
{{SubmitBox|arch=nios2}}
187da432bdf4ac3ae6da1cdfcbd48763d57dea85
Nios/sum args20
0
137
360
2017-10-17T07:25:45Z
Henry
1
Created page with "Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments. Return the sum of all 20 numbers. Over..."
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
43cda664236d22b35921d0e71b9226a011951edf
361
360
2017-10-17T07:51:36Z
Henry
1
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this.
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
d34d4c4a8ce7fcb31cf4cdab4e06f63cc291c9f9
363
361
2017-10-18T05:54:49Z
Henry
1
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this. (This will be particularly useful for functions with variable arguments, e.g., <vlgstat tc="nios/sum_args"/>)
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
bde3417c4ed52f7235e0a43a4e9449d66b195853
364
363
2017-10-18T05:55:58Z
Henry
1
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this. (This will be particularly useful for functions with variable arguments, e.g., <vlgstat tc="nios/sum_args"/>)
<source lang="c">int sum(int n1, int n2, int n3, ... , int n20);</source>
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
f01b119ebfed6ea69dd08009794185d029b4f30f
365
364
2017-10-18T05:56:06Z
Henry
1
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this. (This will be particularly useful for functions with variable arguments, e.g., <vlgstat tc="nios/sum_args"/>)
<source lang="c">int sum(int n1, int n2, int n3, ... , int n20);</source>
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
efcdb1cc757249da5dc1088b3e61c4be2ed4f9af
366
365
2017-10-18T05:56:24Z
Henry
1
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this. (This will be particularly useful for functions with variable arguments, e.g., <vlgstat tc="nios/sum_args"/>)
<source lang="c">int sum(int n1, int n2, int n3, ... , int n20);</source>
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
.global sum
sum: }}
{{SubmitBox|arch=nios2}}
074849a015a80ed03db894caf0be42ac154decfb
Nios/structstore
0
139
367
2017-10-18T06:45:05Z
Henry
1
Created page with "Consider the following struct: <source lang="c">struct Codes { char postal_code[7]; unsigned short area_code; };</source> Write a function that will write to a given entry..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct Codes {
char postal_code[7];
unsigned short area_code;
};</source>
Write a function that will write to a given entry of an array of struct Codes. The first two function parameters specify the beginning of the array of structs and which array element to modify (index=0 is the first array element). The third and fourth parameters provide the new value of the postal_code and area_code fields.
You are guaranteed that ''postcode'' is a null-terminated string of no more than 6 characters (not including the NULL). Ensure the ''postal_code'' is also null-terminated (but do not modify any bytes after the null).
<source lang="c">void set_data (struct Codes* array, int index, char *postcode, unsigned short areacode);</source>
{{ExampleBox|Write {"N2L3G1",519} into { {"M5S3G4",416}, {"V6T1Z4",604}, {"K7L3N6",613} } at position 1|2={ {"M5S3G4",416}, {"N2L3G1",519}, {"K7L3N6",613} }| 3=
.data
List:
.string "M5S3G4"
.hword 416
.string "V6T1Z4"
.hword 604
.string "K7L3N6"
.hword 613
.align 2
PCode: .string "N2L3G1"
.text
.global _start
_start:
movia r4, List
movia r5, 1
movia r6, PCode
movia r7, 519
call set_data
1: br 1b # done
set_data: }}
{{SubmitBox|arch=nios2}}
72aa0430611d67a94bb822b51b466fd7f5215b88
Nios/structfind
0
140
368
2017-10-18T20:13:44Z
Henry
1
Created page with "Consider the following struct: <source lang="c">struct ProfitList { unsigned int product_id; int profit; };</source> An array of this struct can be used as a list of produc..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
<source lang="c">struct ProductInfo {
unsigned int product_id;
char *product_name;
};</source>
An array of struct ProductInfo maps each product_id with its name. For this problem, it is not important whether product_name is null or actually points to a valid string.
Given an array of ProfitList, find the product with the maximum profit (profit can be negative). There will be at least one entry in this array. If there is more than one product with maximum profit, return the first one.
Then, look up the product_id in an array of ProductInfo and return the product_name for that product. If the maximum-profit product isn't in the ProductInfo list, return 0.
<source lang="c">char* find (struct ProfitList* profit_array, unsigned int profit_array_entries, struct ProductInfo* info_array, unsigned int info_array_entries);</source>
{{ExampleBox|[See sample input below]|2=r2=0x210| 3=
# Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11 # 11 in the maximum profit. Product_id=0x1001
.word 0x1002, 9
ProdInfo:
.word 0x1000, 0x200
.word 0x1001, 0x210 # Product_id 0x1001 has name 0x210. Return 0x210.
.word 0x1002, 0x220
.text
.global _start
_start:
movia r4, ProdList
movia r5, 3
movia r6, ProdInfo
movia r7, 3
call find
1: br 1b # done
# Your function starts here:
find: }}
{{SubmitBox|arch=nios2}}
bb36c532a80bbdb9e6c1b3a9c96b9253c28726ff
Nios/structsort
0
141
369
2017-10-18T21:25:07Z
Henry
1
Created page with "Consider the following struct: <source lang="c">struct ProfitList { unsigned int product_id; int profit; };</source> An array of this struct can be used as a list of produc..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
Given an array of ProfitList, sort the list by profit (descending), then by product_id (ascending) if the profit is the same. In other words, the highest profit product should be moved to the beginning of the array, and if two products have the same profit, the one with smaller product id comes first.
<source lang="c">void sort (struct ProfitList* profit_array, unsigned int profit_array_entries);</source>
{{ExampleBox|[See sample input below]|2=r2=0x210| 3=
# Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11
.word 0x1002, 9
.text
.global _start
_start:
movia r4, ProdList
movia r5, 3
call sort
1: br 1b # done
# Your function starts here:
sort: }}
{{SubmitBox|arch=nios2}}
8b0cde66ef7ecea6d17392b9e7943bc625ebd30f
370
369
2017-10-18T23:02:29Z
Henry
1
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
Given an array of ProfitList, sort the list by profit (descending), then by product_id (ascending) if the profit is the same. In other words, the highest profit product should be moved to the beginning of the array, and if two products have the same profit, the one with smaller product id comes first.
<source lang="c">void sort (struct ProfitList* profit_array, unsigned int profit_array_entries);</source>
{{ExampleBox|[See sample input below]|[The sorted array]| 3=
# Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11
.word 0x1002, 9
.text
.global _start
_start:
movia r4, ProdList
movia r5, 3
call sort
1: br 1b # done
# Your function starts here:
sort: }}
{{SubmitBox|arch=nios2}}
9ca7072fbf2b16bda252bdfb8d191a6f50ca48de
Nios/findstack
0
142
371
2017-10-19T03:41:12Z
Henry
1
mo
wikitext
text/x-wiki
Write a function that will return the beginning of the stack frame of the function. This is the value of <tt>sp</tt> at the beginning of the function, and would point to the first function parameter passed on the stack (i.e., the 5th function parameter), if any.
{{ExampleBox|[none]|2=r2=0x04000000| 3=
# Some testing code
.global _start
_start:
movia sp, 0x4000000
call where
1: br 1b # done
# Your function starts here:
where: }}
{{SubmitBox|arch=nios2}}
b89a333582d91128322587740a3b25df1b727448
Nios/findlabel
0
143
372
2017-10-19T03:47:03Z
Henry
1
Created page with "Write a function that will return the location pointed to by the label <tt>Waldo</tt>. {{ExampleBox|[none]|2=r2=0x04000000| 3= # Some testing code # Make sure to submit with..."
wikitext
text/x-wiki
Write a function that will return the location pointed to by the label <tt>Waldo</tt>.
{{ExampleBox|[none]|2=r2=0x04000000| 3=
# Some testing code
# Make sure to submit without "Waldo" defined in your code, or you will get a "multiple definition" error.
# Waldo: .string "Where's Waldo??"
.global _start
_start:
call where
1: br 1b # done
# Your function starts here:
where: }}
{{SubmitBox|arch=nios2}}
8bffe1d90e3aabfec73f6b048a1398fd0495215e
Nios/findme
0
144
373
2017-10-19T05:06:12Z
Henry
1
Created page with "Write a function that will return the location of the first opcode of your function (i.e., where in memory your function starts). {{ExampleBox|[none]|[varies]| 3= # Some tes..."
wikitext
text/x-wiki
Write a function that will return the location of the first opcode of your function (i.e., where in memory your function starts).
{{ExampleBox|[none]|[varies]| 3=
# Some testing code
.global _start
_start:
call where
1: br 1b # done
# Your function starts here:
where: }}
{{SubmitBox|arch=nios2}}
67a8379444f0c81569b0d82d9982ec1b9e7e59de
Nios/findfunction
0
145
374
2017-10-19T05:11:53Z
Henry
1
Created page with "You are provided a function named <tt>MyFunc</tt>. Write a function that will return the first opcode (32-bit word) of the function <tt>MyFunc</tt>. {{ExampleBox|[none]|2=r2=..."
wikitext
text/x-wiki
You are provided a function named <tt>MyFunc</tt>. Write a function that will return the first opcode (32-bit word) of the function <tt>MyFunc</tt>.
{{ExampleBox|[none]|2=r2=0x04000000| 3=
# Some testing code
# Make sure to submit without "MyFunc" defined in your code, or you will get a "multiple definition" error.
# MyFunc: ret
.global _start
_start:
call get_opcode
1: br 1b # done
# Your function starts here:
get_opcode: }}
{{SubmitBox|arch=nios2}}
a597dfd11da78429b157329d17e2df79d84ef731
Nios/findcaller
0
146
375
2017-10-19T06:12:07Z
Henry
1
Created page with "Write a function that will return the location of the call instruction that called your function. {{ExampleBox|[none][varies]| 3= # Some testing code .global _start _start:..."
wikitext
text/x-wiki
Write a function that will return the location of the call instruction that called your function.
{{ExampleBox|[none][varies]| 3=
# Some testing code
.global _start
_start:
call where
1: br 1b # done
# Your function starts here:
where: }}
{{SubmitBox|arch=nios2}}
4544bcce51ce389180ea118c76d19036815bd878
377
375
2017-10-19T21:46:10Z
Henry
1
wikitext
text/x-wiki
Write a function that will return the location of the call instruction that called your function.
{{ExampleBox|[none]|[varies]| 3=
# Some testing code
.global _start
_start:
call where
1: br 1b # done
# Your function starts here:
where: }}
{{SubmitBox|arch=nios2}}
f0ff3529091d1a8002f494f69baf36d4c3247a37
Nios/findintr
0
147
376
2017-10-19T06:20:07Z
Henry
1
Created page with "Write a function that will return whether a given interrupt line is enabled. Return 1 if enabled, 0 if not. The IRQ line (first parameter) is guaranteed to be between 0 and 31..."
wikitext
text/x-wiki
Write a function that will return whether a given interrupt line is enabled. Return 1 if enabled, 0 if not. The IRQ line (first parameter) is guaranteed to be between 0 and 31. An interrupt is enabled if both global interrupts are enabled, and the specific IRQ line is also enabled.
{{ExampleBox|[none]|0| 3=
# Some testing code
.global _start
_start:
# Enable interrupts here to test
movi r4, 5 # Is IRQ 5 enabled?
call intr_enabled
1: br 1b # done
# Your function starts here:
intr_enabled: }}
{{SubmitBox|arch=nios2}}
cff7362658e27cb888d2f2a4a3195bebecb66178
Nios/loadexec
0
148
378
2017-10-19T22:07:15Z
Henry
1
Created page with "Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter. <source la..."
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( void(*dest)(int), void(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length''. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param''. (i.e., with ''dest'' as a function pointer, do <tt>dest(param)</tt>)
{{ExampleBox|[See below]|[None]| 3=
# Some testing code
# When debugging in CPUlator, turn off the following debugging checks:
# - Instruction fetch: Modified opcode
# - Instruction fetch: Outside a code section (If Dest is outside the .text section)
.data
Src:
add r2, r4, r4 # This function returns double its parameter.
ret
Dest:
.skip 8 # Make space for the code
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 8 # There are 2 instructions to copy: 8 bytes
movia r7, 10 # Let's call the function with parameter 10
call loadexec
1: br 1b # done
# Your function starts here:
loadexec: }}
{{SubmitBox|arch=nios2}}
7afa59049c210aa8384388685a8abf54b7dcc853
379
378
2017-10-19T22:09:21Z
Henry
1
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( void(*dest)(int), void(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length''. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param''. (i.e., with ''dest'' as a function pointer, do <tt>dest(param)</tt>)
{{ExampleBox|[See below]|[None]| 3=
# Some testing code
# When debugging in CPUlator, turn off the following debugging checks:
# - Instruction fetch: Modified opcode
# - Instruction fetch: Outside a code section (If Dest is outside the .text section)
Src:
add r2, r4, r4 # This function returns double its parameter.
ret
Dest:
.skip 8 # Make space for the code
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 8 # There are 2 instructions to copy: 8 bytes
movia r7, 10 # Let's call the function with parameter 10
call loadexec
1: br 1b # done
# Your function starts here:
loadexec: }}
{{SubmitBox|arch=nios2}}
8c1afa1a27c2eaee0df9aa88a60aacfc7aa641df
380
379
2017-10-19T22:15:58Z
Henry
1
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( int(*dest)(int), int(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length''. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param'', and returning its return value (i.e., with ''dest'' as a function pointer, do <tt>return dest(param)</tt>)
{{ExampleBox|[See below]|[None]| 3=
# Some testing code
# When debugging in CPUlator, turn off the following debugging checks:
# - Instruction fetch: Modified opcode
# - Instruction fetch: Outside a code section (If Dest is outside the .text section)
Src:
add r2, r4, r4 # This function returns double its parameter.
ret
Dest:
.skip 8 # Make space for the code
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 8 # There are 2 instructions to copy: 8 bytes
movia r7, 4 # Let's call the function with parameter 4
call loadexec
1: br 1b # done
# Your function starts here:
loadexec: }}
{{SubmitBox|arch=nios2}}
1b71e9c37b06a86f89fd40359add599d11621df8
381
380
2017-10-19T22:16:25Z
Henry
1
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( int(*dest)(int), int(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length''. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param'', and returning its return value (i.e., with ''dest'' as a function pointer, do <tt>return dest(param)</tt>)
{{ExampleBox|[See below]|2=r2=8| 3=
# Some testing code
# When debugging in CPUlator, turn off the following debugging checks:
# - Instruction fetch: Modified opcode
# - Instruction fetch: Outside a code section (If Dest is outside the .text section)
Src:
add r2, r4, r4 # This function returns double its parameter.
ret
Dest:
.skip 8 # Make space for the code
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 8 # There are 2 instructions to copy: 8 bytes
movia r7, 4 # Let's call the function with parameter 4
call loadexec
1: br 1b # done
# Your function starts here:
loadexec: }}
{{SubmitBox|arch=nios2}}
9d8168697a4722cc5cb05fa98c87d7f1064c5cc0
File:7seg.png
6
149
382
2017-10-20T01:38:55Z
Henry
1
wikitext
text/x-wiki
da39a3ee5e6b4b0d3255bfef95601890afd80709
Nios/7seg
0
150
383
2017-10-20T01:44:35Z
Henry
1
Created page with "Write a function that will compute a 7-bit value suitable for displaying one hexadecimal digit (0 to f) on a seven-segment display. Each of the display's segments maps to one..."
wikitext
text/x-wiki
Write a function that will compute a 7-bit value suitable for displaying one hexadecimal digit (0 to f) on a seven-segment display. Each of the display's segments maps to one bit of the number, as indicated in the diagram below. Because the display has 7 segments, only the lowest 7 bits are used. Set the upper bits to zero.
Your function will be passed one parameter: The number to be displayed (guaranteed to be 0 to 15). Return the appropriate bit pattern.
[[File:7seg.png]]
{{ExampleBox|1=r4=8|2=r2=0x7f| 3=
# Some testing code
.global _start
_start:
movi r4, 8
call sevenseg
1: br 1b # done
# Your function starts here:
sevenseg: }}
{{SubmitBox|arch=nios2}}
27219596ff20c129a4014c265ad37b53f99f27d1
384
383
2017-10-20T01:45:12Z
Henry
1
wikitext
text/x-wiki
Write a function that will compute a 7-bit value suitable for displaying one hexadecimal digit (0 to f) on a seven-segment display. Each of the display's segments maps to one bit of the number, as indicated in the diagram below (1=on, 0=off). Because the display has 7 segments, only the lowest 7 bits are used. Set the upper bits to zero.
Your function will be passed one parameter: The number to be displayed (guaranteed to be 0 to 15). Return the appropriate bit pattern.
[[File:7seg.png]]
{{ExampleBox|1=r4=8|2=r2=0x7f| 3=
# Some testing code
.global _start
_start:
movi r4, 8
call sevenseg
1: br 1b # done
# Your function starts here:
sevenseg: }}
{{SubmitBox|arch=nios2}}
36dd6daec9122d6756e0de9efabfec72b634d9c0
Nios/7seg8
0
151
385
2017-10-20T03:24:54Z
Henry
1
Created page with "Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated..."
wikitext
text/x-wiki
Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated into two groups of four, with each group of four being controlled by a 32-bit bit pattern (as four groups of 8 bits, with the highest bit of each byte unused).
<ul><li>bit[6:0]: right-most digit</li>
<li>bit[14:8]</li>
<li>bit[22:16]</li>
<li>bit[30:24]: left-most digit</li></ul>
<source lang="c">unsigned long long hexdisplay(unsigned int number);</source>
Your function will be passed one parameter: The number to be displayed. It should return the 64-bit bit pattern in r2 (least-significant 32 bits) and r3 (most-significant 32 bits).
Use the following bit patterns for digits. You may wish to reuse <vlgstat tc="Nios/7seg"/>.
[[File:7seg.png]]
{{ExampleBox|1=r4=8|2=r3=0x3f3f3f3f, r2=0x3f3f3f7f| 3=
# Some testing code
.global _start
_start:
movi r4, 8
call hexdisplay
1: br 1b # done
# Your function starts here:
hexdisplay: }}
{{SubmitBox|arch=nios2}}
7338ec15b6c8a4e4a38f0963f6514fe8f4c23092
Nios/accum1
0
152
386
2017-10-20T04:29:15Z
Henry
1
Created page with "Write a function that performs a sequence of calculations (addition, subtraction, multiplication), following instructions encoded in an array of bytes. This calculator is ba..."
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication), following instructions encoded in an array of bytes.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>null: Return from the function and return the current Accumulator value in r2.</li></ol>
For example, the (null-terminated) string "+0+@-P" encodes 4 operations:
<ol><li>"+0": Add 0x30 to the accumulator. The accumulator starts off as 0, and now contains 0x30</li>
<li>"+@": Add 0x40 to the accumulator. The accumulator now contains 0x70</li>
<li>"-P": Subtract 0x50 from the accumulator. The accumulator now contains 0x20</li>
<li>null: Quit. The function returns 0x20 in r2</li>
</ol>
Similarly, the following will compute 100*100:
<source lang="gas">.byte '+', 100, '*', 100, 0</source>
Starting with an accumulator with 0, add 100, then multiply by 100, then return the result.
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|"+0+@-P"|2=r2=0x20| 3=
# Some testing code
.data
Cmd: .string "+0+@-P"
.text
.global _start
_start:
movia r4, Cmd
call calc
1: br 1b # done
# Your function starts here:
calc: }}
{{SubmitBox|arch=nios2}}
8a6edc7728e409b60c369fb1a1d5f4b746f09c2b
Nios/accum2
0
153
387
2017-10-20T04:42:32Z
Henry
1
Created page with "Write a function that performs a sequence of calculations (addition, subtraction, multiplication, conditional branch), following instructions encoded in an array of bytes. Thi..."
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication, conditional branch), following instructions encoded in an array of bytes. This is an extension of <vlgstat tc="Nios/accum1"/>, by adding two conditional branch instructions.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', 'b', 'B', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>'b': '''If Accumulator < 0''', then skip over ''operand'' instructions and keep going. ''operand'' = 0 means continue with the following instruction, while ''operand'' = -1 means go backwards one instruction (equivalent to repeating the 'b' instruction forever.). '''If accumulator >= 0''', then do nothing and continue reading the next instruction.</li>
<li>'B': This is exactly the same as 'b', but with the condition reversed. Branch if accumulator >= 0.</li>
<li>null: Return from the function and return the current Accumulator value in r2.</li></ol>
For example the following will compute 1+3:
<source lang="gas">.byte '+', 1, 'B', 1, '+', 2, '+', 3, 0</source>
Starting with an accumulator with 0, add 1, then skip over 1 instruction because the accumulator is non-negative, then add 3. (The "add 2" is skipped over because the branch-if-non-negative occurred with an accumulator of 1)
But the following will compute 1+2+3, because the branch-if-negative is not taken:
<source lang="gas">.byte '+', 1, 'b', 1, '+', 2, '+', 3, 0</source>
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|+ 1, B 1, + 2, + 3|2=r2=0x4| 3=
# Some testing code
.data
Cmd: .byte '+', 1, 'B', 1, '+', 2, '+', 3, 0
Cmd2: .byte '+', 1, 'b', 1, '+', 2, '+', 3, 0
.text
.global _start
_start:
movia r4, Cmd
call calc
1: br 1b # done
# Your function starts here:
calc: }}
{{SubmitBox|arch=nios2}}
9e66597f8ef9c1205e27abce7224cd5a8aa30a5a
Nios/ifelse1
0
154
388
2017-10-20T07:20:10Z
Henry
1
Created page with "Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even. <syntaxhighlight lang..."
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
{{ExampleBox|1|[no output, odd() is called]|3=
# Some testing code
# You may uncomment these during testing
# odd: ret
# even: ret
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call oddeven
1: br 1b # Done
oddeven:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
b2afc687ba3e8a21fffa1f8e19f16f3508fa2ffb
Nios/ifthen
0
155
389
2017-10-20T08:30:38Z
Henry
1
Created page with "You are designing a machine to serve food at a cafeteria. Each order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Ch..."
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: When the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when all requested items have been added.
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
{{ExampleBox|1=r2=5|2=add_a, add_c, and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
528aed47ccbb5bb5cb5222c2b9857e931e12a6e5
390
389
2017-10-20T08:32:14Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
{{ExampleBox|1=r2=5|2=add_a, add_c, and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
004847be981f74cf34c24f6cf2a64b28e28916e6
392
390
2017-10-20T08:50:34Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
{{ExampleBox|1=r4=5|2=add_a, add_c, and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
8210708d04f0732e6d3a08b4adb26bc7f5b523e2
395
392
2017-10-20T09:34:14Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a, add_c, and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
f37db8a80f7e5c3a6e24ccdb40cf759deefbe4e2
398
395
2017-10-20T09:36:31Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions also do not clobber any registers.
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a, add_c, and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
bf623f58d485d4e8d5c20263e3b3560e73a5ac40
399
398
2017-10-20T09:37:00Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a, add_c, and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
a127e2721840a0a3a149b49608408278d684c48c
Nios/ifelse2
0
156
391
2017-10-20T08:47:52Z
Henry
1
Created page with "You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples,..."
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
{{ExampleBox|1=r2=5|2=add_a and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
c1af09dace2c0af3daddb236350caf6340071608
393
391
2017-10-20T08:50:39Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
{{ExampleBox|1=r4=5|2=add_a and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
5a4c27c2e9ddd04783164e58b4e586892ca65f15
394
393
2017-10-20T09:33:52Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
cd5de537ba8af506b2af85a85e0ff4ccefa472fc
396
394
2017-10-20T09:34:20Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
94347539d2b880979258e9aafa0ae92d00728120
397
396
2017-10-20T09:36:18Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions also do not clobber any registers.
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
978fe4deb1f1dd201e99a949d9edee332931f7b3
400
397
2017-10-20T09:37:04Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r4=5|2=add_a and done are called|3=
# Some testing code
# You may uncomment these during testing
# add_a: ret
# add_b: ret
# add_c: ret
# add_d: ret
# add_e: ret
# done: ret
.global _start
_start:
movia r4, 5 # First function parameter is always passed through r4.
call build
1: br 1b # Done
build:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
2ad3f2d54ede117c89df9605f45e45c7d8a367f6
Nios index
0
18
401
249
2017-10-21T04:18:12Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Uncategorized ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
c1e50fb9773b09e1be38ac588037871d0ed68e73
Nios index
0
18
402
401
2017-10-21T04:30:32Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== I'll sort these soon... ===
==== Declaring memory ====
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
==== Control Flow ====
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
==== Arithmetic ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
==== Memory Operations ====
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
==== Functions ====
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
==== Program Structure ====
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
==== Slightly longer problems ====
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
==== Misc ====
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
73476a9eb0a6d6c44ec998421f7fd021358832d3
403
402
2017-10-21T04:30:50Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Newly-added problems: I'll sort these soon... ===
==== Declaring memory ====
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
==== Control Flow ====
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
==== Arithmetic ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
==== Memory Operations ====
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
==== Functions ====
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
==== Program Structure ====
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
==== Slightly longer problems ====
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
==== Misc ====
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
d2371c7e65ceb1c6f35415a29de6f5a591991f04
405
403
2017-10-21T04:32:14Z
Henry
1
/* Control Flow */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Newly-added problems: I'll sort these soon... ===
==== Declaring memory ====
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
==== Control Flow ====
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
==== Arithmetic ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
==== Memory Operations ====
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
==== Functions ====
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
==== Program Structure ====
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
==== Slightly longer problems ====
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
==== Misc ====
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
7ed2eb818d36580d57ba879b8dd6e20e27b526d6
406
405
2017-10-21T04:36:46Z
Henry
1
/* Slightly longer problems */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Newly-added problems: I'll sort these soon... ===
==== Declaring memory ====
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
==== Control Flow ====
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
==== Arithmetic ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
==== Memory Operations ====
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
==== Functions ====
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
==== Program Structure ====
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
==== Short Programs ====
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
==== Misc ====
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
070c4470ba8567f4a544bf0b28f08bc962bed34f
HDLBits:ProblemMenu
3072
89
404
286
2017-10-21T04:31:06Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Newly-added problems: I'll sort these soon...<ul><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li></ul></li><li>Control Flow<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>Slightly longer problems<ul><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Shift</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li></ul></li><li>Misc<ul><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Creating a big memory from many small ones</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
4b73ac1923a154088b99d0c0816e7a78e81bc5ff
407
404
2017-10-21T04:37:01Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Newly-added problems: I'll sort these soon...<ul><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li></ul></li><li>Control Flow<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>Short Programs<ul><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Shift</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li></ul></li><li>Misc<ul><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Creating a big memory from many small ones</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
f5de8675c2f548886cbff06bb0aa5b0ef15d5577
410
407
2017-10-21T04:55:33Z
Henry
1
Replaced content with "aoeu"
wikitext
text/x-wiki
aoeu
15987e60950cf22655b9323bc1e281f9c4aff47e
411
410
2017-10-21T04:55:45Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Newly-added problems: I'll sort these soon...<ul><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li></ul></li><li>Control Flow<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>Short Programs<ul><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Shift</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li></ul></li><li>Misc<ul><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Creating a big memory from many small ones</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
f5de8675c2f548886cbff06bb0aa5b0ef15d5577
Nios/ifelse1
0
154
408
388
2017-10-21T04:39:12Z
Henry
1
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
You are provided the functions <tt>odd</tt> and <tt>even</tt>. To make the problem easier, these two functions do not clobber any registers.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
{{ExampleBox|1|[no output, odd() is called]|3=
# Some testing code
# You may uncomment these during testing, but comment them out before submitting
# odd: ret
# even: ret
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call oddeven
1: br 1b # Done
oddeven:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
3ff102f68248e85ea859e6cc1972745c7b3c176f
409
408
2017-10-21T04:39:40Z
Henry
1
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
You are provided the functions <tt>odd</tt> and <tt>even</tt>. To make the problem easier, these two functions do not clobber any registers.
{{ExampleBox|1|[no output, odd() is called]|3=
# Some testing code
# You may uncomment these during testing, but comment them out before submitting
# odd: ret
# even: ret
.global _start
_start:
movia r4, 1 # First function parameter is always passed through r4.
call oddeven
1: br 1b # Done
oddeven:
# Because there are nested function calls, ra needs to be saved and restored.
subi sp, sp, 4
stw ra, 0(sp)
# Your code here
# Because there are nested function calls, ra needs to be saved and restored.
ldw ra, 0(sp)
addi sp, sp, 4
ret
}}
{{SubmitBox|arch=nios2}}
cb5754f64ed9afb422693b4503c5d18102623b46
Nios/findme
0
144
412
373
2017-10-27T22:59:02Z
Henry
1
wikitext
text/x-wiki
Write a function that will return the location of the first instruction of your function (i.e., where in memory your function starts).
{{ExampleBox|[none]|[varies]| 3=
# Some testing code
.global _start
_start:
call where
1: br 1b # done
# Your function starts here:
where: }}
{{SubmitBox|arch=nios2}}
7c26ebf56e2cb7a67003bbe9e202fa4581d3571f
Nios/findfunction
0
145
413
374
2017-10-27T22:59:40Z
Henry
1
wikitext
text/x-wiki
You are provided a function named <tt>MyFunc</tt>. Write a function that will return the first instruction (32-bit word) of the function <tt>MyFunc</tt>.
{{ExampleBox|[none]|2=r2=0x04000000| 3=
# Some testing code
# Make sure to submit without "MyFunc" defined in your code, or you will get a "multiple definition" error.
# MyFunc: ret
.global _start
_start:
call get_opcode
1: br 1b # done
# Your function starts here:
get_opcode: }}
{{SubmitBox|arch=nios2}}
24e2d275fa242581cf7db869dc0f988bac58bcc5
Nios/random
0
157
414
2017-10-28T03:19:30Z
Henry
1
Created page with "A ''linear congruential generator'' is a simple method often used to generate pseudorandom number sequences. The sequence starts with an arbitrary number (called a "seed"). Th..."
wikitext
text/x-wiki
A ''linear congruential generator'' is a simple method often used to generate pseudorandom number sequences. The sequence starts with an arbitrary number (called a "seed"). Then to generate the next number in the sequence, multiply by a constant ("multiplier"), then add another constant ("increment").
In this problem, we will use a seed of 0, a multiplier of 134775813, and an increment of 1. Thus, the first few numbers in the sequence are:
<ul><li>0<sup>th</sup>: 0 (This is the seed. We'll call it the 0<sup>th</sup> number)</li>
<li>1<sup>st</sup>: 1 (<b>0</b> × 134775813 + 1)</li>
<li>2<sup>nd</sup>: 134775814 (<b>1</b> × 134775813 + 1)</li></ul>
When the number overflows, keep the lowest 32 bits (i.e., mod 2<sup>32</sup>). This happens automatically without extra code.
Write a function that returns the ''n<sup>th</sup>'' number in the above sequence.
<syntaxhighlight lang="c">unsigned random (unsigned n);</syntaxhighlight>
{{ExampleBox|1=r4=2
|2=r2=134775814|3=
.global _start
_start:
movia r4, 2 # First function parameter is always passed through r4.
call random
1: br 1b # Done
random:}}
{{SubmitBox|arch=nios2}}
b2a0b0495d1aebd86d01e54f3a545206e53dcbd0
Nios/manhattan
0
158
415
2017-10-28T15:40:24Z
Henry
1
Created page with "You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map (you are currently at the center of the map). Fin..."
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map (you are currently at the center of the map). Find the distance to the closest subway station, measured using [[https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance]] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1x1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5 x 1 map, the nearest subway station is 1 unit away (to the right). You are at x=5 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
movi r4, 5 # width
movi r5, 1 # height
movia r6, Map # Pointer to 2D char array
call manhattan
1: br 1b # Done
manhattan:}}
{{SubmitBox|arch=nios2}}
55e03e4b38681c2bbb640a6c2f0a3c4fbbd26f4f
416
415
2017-10-30T02:22:09Z
Henry
1
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map (you are currently at the center of the map). Find the distance to the closest subway station, measured using [https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1x1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5 x 1 map, the nearest subway station is 1 unit away (to the right). You are at x=5 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
movi r4, 5 # width
movi r5, 1 # height
movia r6, Map # Pointer to 2D char array
call manhattan
1: br 1b # Done
manhattan:}}
{{SubmitBox|arch=nios2}}
171472a39bece4a67e3c4776df7f87bc28f4ca6c
417
416
2017-10-30T02:22:34Z
Henry
1
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map that indicates the locations of subway stations. You are currently at the center of the map. Find the distance to the closest subway station, measured using [https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1x1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5 x 1 map, the nearest subway station is 1 unit away (to the right). You are at x=5 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
movi r4, 5 # width
movi r5, 1 # height
movia r6, Map # Pointer to 2D char array
call manhattan
1: br 1b # Done
manhattan:}}
{{SubmitBox|arch=nios2}}
ac6049b2d62e7119edcb6c1df665a4947568071f
418
417
2017-10-30T02:23:41Z
Henry
1
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map that indicates the locations of subway stations. You are currently at the center of the map. Find the distance to the closest subway station, measured using [https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1x1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5 x 1 map, the nearest subway station is 1 unit away (to the right). You are at x=2 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
movi r4, 5 # width
movi r5, 1 # height
movia r6, Map # Pointer to 2D char array
call manhattan
1: br 1b # Done
manhattan:}}
{{SubmitBox|arch=nios2}}
cc27183b9b22dd34afc815b2ee9cfe0ddc37089b
Nios/square
0
159
419
2017-10-30T06:08:25Z
Henry
1
Created page with "Write a function that will draw a white square onto a 640×480, 16 bit per pixel image. The image is an array of 640 pixels per row (left to right) and 480 rows (top to..."
wikitext
text/x-wiki
Write a function that will draw a white square onto a 640×480, 16 bit per pixel image.
The image is an array of 640 pixels per row (left to right) and 480 rows (top to bottom), where each pixel is 16 bits (2 bytes) (Thus, there are 1280 bytes per row). The top-left corner of the image is pixel (0, 0), while the bottom right is pixel (639, 479). A white pixel has the 16-bit value 0xffff.
Draw a white square of the given size (width and height), with the upper-left corner of the square located at the given left and top pixels. The square will have size at least 1 pixel, and the entire square will fit in the image (you do not need to check for the square exceeding the image boundaries).
<syntaxhighlight lang="c">int square (void* image, int left, int top, int size);</syntaxhighlight>
{{ExampleBox|1=square(Img, 1, 0, 3)|
2=See below|3=
.data
Img: .skip 640*480*2
.text
.global _start
_start:
movia r4, Img # Image
movi r5, 1 # top
movi r6, 0 # left
movi r7, 3 # size
call square
1: br 1b # Done
square:}}
{{SubmitBox|arch=nios2}}
16b69c2450f14fe5aaaa008b700ac199b6761928
Nios/uartread
0
160
420
2017-10-30T08:52:45Z
Henry
1
Created page with "Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. Replace the \n character with a null charact..."
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
{{ExampleBox||
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
.global _start
_start:
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2}}
c257b925c91b23b5caea3d0164a0bebd7e791301
421
420
2017-10-30T19:06:19Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. Replace the \n character with a null character in the output string. Return the length of the string.
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, the function only clobbers r2 (the return value).
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
{{ExampleBox||
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
.global _start
_start:
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2}}
cebef2d6069c688a6773804697e177e02fe1fe60
425
421
2017-10-30T21:25:20Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. Replace the \n character with a null character in the output string. Return the length of the string.
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, the function only clobbers r2 (the return value).
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
{{ExampleBox||
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
.global _start
_start:
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2|simsystem=}}
271b7c3e7bcf83581c86a17944bfb5d3445ed3c1
426
425
2017-10-30T21:31:45Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{ExampleBox||
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
.global _start
_start:
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2|simsystem=}}
19b40bcbe84784c7db053813b9a9c60afccbaa10
428
426
2017-10-31T02:05:50Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{ExampleBox||
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
#read_uart: # This may be useful for debugging
movia r2, 0xff201000
ldwio r2, 0(r2)
ret
.global _start
_start:
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2|simsystem=}}
53fd42dc8a2064c5f7809f70ef94b7fd1cbd875b
429
428
2017-10-31T02:07:57Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{ExampleBox||
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
#read_uart: # This may be useful for debugging
movia r2, 0xff201000
ldwio r2, 0(r2)
ret
.global _start
_start:
movia sp, 0x04000000
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2|simsystem=}}
fc9342a782c5066caf50f0e571303a88d5d7838f
430
429
2017-10-31T02:14:52Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{ExampleBox|1="Hello world" | 2=r2=11
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
#read_uart: # This may be useful for debugging
movia r2, 0xff201000
ldwio r2, 0(r2)
ret
.global _start
_start:
movia sp, 0x04000000 # Initialize SP for debugging.
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{SubmitBox|arch=nios2|simsystem=}}
dccce8395d0bf75d4d4595cccfe375de70a06d1d
431
430
2017-10-31T02:17:28Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit 15: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r2=11
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
#read_uart: # This may be useful for debugging
movia r2, 0xff201000
ldwio r2, 0(r2)
ret
.global _start
_start:
movia sp, 0x04000000 # Initialize SP for debugging.
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=nios2|simsystem=}}
a79145d5a42765ab956047fb9aebca24c0c84ea0
432
431
2017-10-31T02:18:19Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit [15]: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r2=11
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
#read_uart: # This may be useful for debugging
movia r2, 0xff201000
ldwio r2, 0(r2)
ret
.global _start
_start:
movia sp, 0x04000000 # Initialize SP for debugging.
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=nios2|simsystem=}}
dcfc436756dd5696501eb0daff5894eced6bb314
Template:SubmitBox
10
15
422
284
2017-10-30T21:23:13Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + (!"</html>{{{simsystem|}}}<html>" ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
8fe71dae7a07dca9af99d48563cacd08bd200f27
423
422
2017-10-30T21:24:45Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + (("default" != "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
9f71a90e763ba9c138e8b1470da3221127f3eaae
424
423
2017-10-30T21:25:09Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + (("default" == "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>");
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
c98848c64320ef3446f0cc7c43d3884327311a72
427
424
2017-10-31T01:56:43Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + (("default" == "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
1b05eb33c3d8f9fa2929bbbc60f702350cf5f032
Nios/cacheblock
0
161
433
2017-10-31T02:56:02Z
Henry
1
Created page with "Consider the following cache: <ul><li>12 KB (12,288 bytes)</li> <li>3-way set-associative</li> <li>256 sets</li></ul> Write a function that will determine whether two address..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>12 KB (12,288 bytes)</li>
<li>3-way set-associative</li>
<li>256 sets</li></ul>
Write a function that will determine whether two addresses fall within the same cache block in this cache. Your function must return 1 or 0.
{{ExampleBox|1=cacheblock(0, 2) | 2=r2=1
|3=
.global _start
_start:
movia r4, 0
movia r5, 2
call cacheblock
1: br 1b # Done
cacheblock:}}
{{SubmitBox|arch=nios2}}
e881cc2b2c09255244b28c2e68387c0bb25361fc
Nios/cacheset
0
162
434
2017-10-31T03:07:52Z
Henry
1
Created page with "Consider the following cache: <ul><li>12 KB (12,288 bytes)</li> <li>3-way set-associative</li> <li>256 sets</li></ul> Write a function that will determine whether two address..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>12 KB (12,288 bytes)</li>
<li>3-way set-associative</li>
<li>256 sets</li></ul>
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function must return 1 or 0.
{{ExampleBox|1=cacheblock(0, 2) | 2=r2=1
|3=
.global _start
_start:
movia r4, 0
movia r5, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{SubmitBox|arch=nios2}}
f41af650db147a745897b749653a70b4805609dd
Nios/cacheset2
0
163
435
2017-10-31T03:56:48Z
Henry
1
Created page with "Consider the following cache: <ul><li>2<sup>S</sup> sets</li> <li>2<sup>B</sup> block size</li></ul> Write a function that will determine whether two addresses will map to th..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether the two addresses map to the same cache set. S and B will be reasonable values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r2=1
|3=
.global _start
_start:
movi r4, 8
movi r5, 4
movia r6, 0
movia r7, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{HintBox|The shift instructions cannot shift by 32.}}
{{SubmitBox|arch=nios2}}
3ca90ce73c200b821aa3ffe09c500726900ba603
436
435
2017-10-31T03:57:18Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether the two addresses map to the same cache set. S and B will be reasonable values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r2=1
|3=
.global _start
_start:
movi r4, 8
movi r5, 4
movia r6, 0
movia r7, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{HintBox|Case 13 and 14: The shift instructions cannot shift by 32.}}
{{SubmitBox|arch=nios2}}
26b6a1ca444bba0a05703d48a3d8b8b2c83253a8
439
436
2017-10-31T06:21:57Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether the two addresses map to the same cache set. S and B will be valid values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r2=1
|3=
.global _start
_start:
movi r4, 8
movi r5, 4
movia r6, 0
movia r7, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{HintBox|Case 13 and 14: The shift instructions cannot shift by 32.}}
{{SubmitBox|arch=nios2}}
5833a22574d39bc63f49a2f5e95cd73292004e96
Nios/cacheset3
0
164
437
2017-10-31T05:26:02Z
Henry
1
Created page with "Consider the following cache: <ul><li>2<sup>S</sup> sets</li> <li>2<sup>B</sup> block size</li></ul> Write a function that will determine whether an access to one addresses c..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether an access to one addresses can cause the cache line containing the other address to be evicted from the cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether one addresses can cause the eviction of the other. S and B will be valid values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r2=0
|3=
.global _start
_start:
movi r4, 8
movi r5, 4
movia r6, 0
movia r7, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{HintBox|Case 13 and 14: The shift instructions cannot shift by 32.}}
{{SubmitBox|arch=nios2}}
b8ee53725ad9014797fdb603292a36867eacd95f
438
437
2017-10-31T05:26:37Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether an access to one addresses can cause the cache line containing the other address to be evicted from the cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether one address can cause the eviction of the other. S and B will be valid values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r2=0
|3=
.global _start
_start:
movi r4, 8
movi r5, 4
movia r6, 0
movia r7, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{HintBox|Case 13 and 14: The shift instructions cannot shift by 32.}}
{{SubmitBox|arch=nios2}}
0d63142b1df5e5cd83c359de67f6f6d380eb4272
440
438
2017-10-31T06:28:27Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether an access to one addresses can cause the cache line containing the other address to be evicted from the cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether one address can cause the eviction of the other. S and B will be valid values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r2=0
|3=
.global _start
_start:
movi r4, 8
movi r5, 4
movia r6, 0
movia r7, 2
call cacheset
1: br 1b # Done
cacheset:}}
{{HintBox|Case 13+: The shift instructions cannot shift by 32.}}
{{SubmitBox|arch=nios2}}
41d7b63141668924fbc4df95f285c738025a61a1
Nios/cachetag
0
165
441
2017-10-31T08:11:31Z
Henry
1
Created page with "Consider the following cache: <ul><li>Capacity of C bytes</li> <li>Associativity of W ways</li></ul> Write a function that will determine whether the cache blocks holding two..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>Capacity of C bytes</li>
<li>Associativity of W ways</li></ul>
Write a function that will determine whether the cache blocks holding two addresses will have the same tag, for the above cache. Your function will be provided C, W, and two addresses. It must return 1 or 0 to indicate whether the cache blocks holding the two addresses would have the same tag field. C and W will be valid values for a 32-bit address, and will correspond to a cache where the block size and number of sets are powers of two.
<source lang="c">int cachetag(unsigned int C, unsigned int W, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cachetag(12288, 3, 0, 2) (12 KB, 3-way) | 2=r2=1
|3=
.global _start
_start:
movia r4, 12288
movi r5, 3
movia r6, 0
movia r7, 2
call cachetag
1: br 1b # Done
cachetag:}}
{{SubmitBox|arch=nios2}}
570bff10b43516792cb1a269ac3b0081db934b1e
Nios/cachehit
0
166
442
2017-10-31T20:41:01Z
Henry
1
Created page with "Consider the following cache: <ul> <li>Direct-mapped (i.e., 1-way set-associative)</li> <li>2<sup>B</sup> block size</li> <li>2<sup>S</sup> sets</li></ul> Write a function tha..."
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
Cache:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
_asmbits_start:
movi r4, 4
movi r5, 2
movi r6, Cache
movi r7, 0x110
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
091decaf5ac14bdc0c6268e641e72a0c8f6e372e
443
442
2017-10-31T21:24:29Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
_asmbits_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movi r6, CacheTags
movi r7, 0x110 # Is 0x110 in the cache?
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
1bf70509d80065145cbb6a66854eeaa39c044001
444
443
2017-10-31T22:59:44Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (of size 2<sup>S</sup> words, one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
_asmbits_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movi r6, CacheTags
movi r7, 0x110 # Is 0x110 in the cache?
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
b9a8448058486e101fbdbe96920a3e65aba251ee
445
444
2017-10-31T23:00:11Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
_asmbits_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movi r6, CacheTags
movi r7, 0x110 # Is 0x110 in the cache?
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
1bf70509d80065145cbb6a66854eeaa39c044001
446
445
2017-11-01T01:40:12Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
_asmbits_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movi r7, 0x110 # Is 0x110 in the cache?
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
0addddb891ee66d4c4ae6edaa4c3a95d598b0496
449
446
2017-11-01T02:02:28Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movi r7, 0x110 # Is 0x110 in the cache?
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
ffc663c6a0fc845bf9d8727cdc9943cd9fcc0832
451
449
2017-11-01T02:03:17Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
.global _start
_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movi r7, 0x110 # Is 0x110 in the cache?
call cachehit
1: br 1b # Done
cachehit:}}
{{SubmitBox|arch=nios2}}
6f9714c57725a4bef8521da1dabd065eae77d1e7
Nios/cachehits
0
167
447
2017-11-01T01:42:35Z
Henry
1
Created page with "Consider the following cache: <ul> <li>Direct-mapped (i.e., 1-way set-associative)</li> <li>2<sup>B</sup> block size</li> <li>2<sup>S</sup> sets</li></ul> Your function will..."
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
_asmbits_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
83c7571ab19b6c533a40fd377719fecc73407d36
448
447
2017-11-01T01:42:45Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
_asmbits_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
b6ca8f0531d42e3f7b821a4f9393ed8fd6548326
450
448
2017-11-01T02:02:46Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
12d258e3b5340e3f816969b86539bebba824e28c
Nios/cachehits
0
167
452
450
2017-11-01T02:03:27Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
.global _start
_start:
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
4285f18b03ee1d4f90c213d50b2c806339064bb0
453
452
2017-11-01T02:04:20Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
.global _start
_start:
movia sp, sp, 0x40000000 # This problem will probably use the stack
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
9905d751c5db29aa1b588ba4cfa0feae1e7b8b3e
454
453
2017-11-01T02:07:19Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
.global _start
_start:
movia sp, 0x4000000 # This problem will probably use the stack
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
482c3bb520e1affb5b30c0cc032668efa5b8e321
457
454
2017-11-01T04:19:36Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 # This is hit (set 1)
.word 0x120 # This is a miss (set 2)
.word -1
.text
.global _start
_start:
movia sp, 0x4000000 # This problem will probably use the stack
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{HintBox|This is not really following calling conventions... but the next problem will be easier if your function does not modify r4, r5, and r6.}}
{{SubmitBox|arch=nios2}}
c282bc6cbef9341bf25d3fdc7e427117f0a64837
Nios/cachehits2
0
168
455
2017-11-01T02:41:16Z
Henry
1
Created page with "Consider the following cache: <ul> <li>Direct-mapped (i.e., 1-way set-associative)</li> <li>2<sup>B</sup> block size</li> <li>2<sup>S</sup> sets</li></ul> Your function will..."
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine the number of cache hits if the sequence of accesses were performed on the cache with the given initial state. After each access, update the cache state (you may modify the tag array).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined). You may modify this array as the cache state is updated.
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of cache hits if the list of cache accesses were performed on the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x120 # This is a miss (set 2)
.word 0x120 # This is a hit (set 2)
.word 0x122 # This is also hit to the same block (set 2)
.word 0x220 # This is a miss (set 2)
.word -1
.text
.global _start
_start:
movia sp, 0x4000000 # This problem will probably use the stack
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
55ecc7f21d3a4876f95dfb7e9c473405282773be
456
455
2017-11-01T02:41:26Z
Henry
1
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine the number of cache hits if the sequence of accesses were performed on the cache with the given initial state. After each access, update the cache state (you may modify the tag array).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined). You may modify this array as the cache state is updated.
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of cache hits if the list of cache accesses were performed on the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r2=2
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x120 # This is a miss (set 2)
.word 0x120 # This is a hit (set 2)
.word 0x122 # This is also hit to the same block (set 2)
.word 0x220 # This is a miss (set 2)
.word -1
.text
.global _start
_start:
movia sp, 0x4000000 # This problem will probably use the stack
movi r4, 4 # Cache has 2^4 byte blocks
movi r5, 2 # Cache has 2^2 sets
movia r6, CacheTags
movia r7, AddressList
call cachehits
1: br 1b # Done
cachehits:}}
{{SubmitBox|arch=nios2}}
182a4540d42d2ae90b798f1fea6879b77c39f61b
Nios/memaddr
0
169
458
2017-11-01T04:32:18Z
Henry
1
Created page with "Consider a memory array of depth D and width of B bits. How many address lines are needed for this memory array? Write a function that returns the number of address bits for..."
wikitext
text/x-wiki
Consider a memory array of depth D and width of B bits. How many address lines are needed for this memory array?
Write a function that returns the number of address bits for a memory of depth D and width B bits. D and B will be at least 1.
<source lang="c">unsigned int addrlines(unsigned int D, unsigned int B);</source>
{{ExampleBox|1=addrlines(16, 8)| 2=r2=4
|3=
.global _start
_start:
movi r4, 16 # Depth 16
movi r5, 8 # 8 bit wide (128 bits of capacity)
call addrlines
1: br 1b # Done
addrlines:}}
{{SubmitBox|arch=nios2}}
28fff1e2ffb068f3b37851024bbcf012d5ca4406
Nios/memsize
0
170
459
2017-11-01T20:28:56Z
Henry
1
Created page with "Consider a memory array of with A address lines and D data lines. What is the capacity of this memory (in bits)? Write a function that returns the memory capacity (in bits)...."
wikitext
text/x-wiki
Consider a memory array of with A address lines and D data lines. What is the capacity of this memory (in bits)?
Write a function that returns the memory capacity (in bits). The capacity will not overflow a 32-bit unsigned integer.
<source lang="c">unsigned int memsize(unsigned int A, unsigned int D);</source>
{{ExampleBox|1=memsize(12, 8)| 2=r2=32768
|3=
.global _start
_start:
movi r4, 12 # 12 address lines
movi r5, 8 # 8 data lines
call memsize
1: br 1b # Done
memsize:}}
{{SubmitBox|arch=nios2}}
cdbd8b17548b11e7f79d7b33ac3030959ea87492
Nios/memenable
0
171
460
2017-11-01T21:08:01Z
Henry
1
Created page with "You have a 4-KB (kilobyte) memory that is mapped to the address range 0xff3000 – 0xff3fff. Thus, the memory should be enabled only when an address within that range is a..."
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range 0xff3000 – 0xff3fff. Thus, the memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You must not use any add, sub, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed). (In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost.)
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
a83c79535764a713ce75eb308d8e05dea35be756
461
460
2017-11-01T22:54:59Z
Henry
1
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range 0xff3000 – 0xff3fff. Thus, the memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
(In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost. Equality comparisons with a constant are implemented as an AND gate, but less/greater comparisons need to do subtraction, which is much more costly.)
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
cf9ccf5ed147886a02a64397c83c8916f9f84357
462
461
2017-11-01T22:55:56Z
Henry
1
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range 0xff3000 – 0xff3fff. Thus, the memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
<source lang="c">unsigned int memenable(unsigned int address);</source>
<small>In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost. Equality comparisons with a constant can be implemented as an AND gate with some inverted inputs, but less/greater comparisons need to do subtraction, which is much more costly.</small>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
1601cd7d421d307cf2751fced760c65ec28c2733
463
462
2017-11-01T22:58:20Z
Henry
1
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. The memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
<source lang="c">unsigned int memenable(unsigned int address);</source>
<small>In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost. Equality comparisons with a constant can be implemented as an AND gate with some inverted inputs, but less/greater comparisons need to do subtraction, which is much more costly.</small>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
2161302e05b3eb77939adc652a10403a26620c0d
469
463
2017-11-01T23:24:44Z
Henry
1
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. The memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (equal or not-equal comparisons and branches are allowed).
<source lang="c">unsigned int memenable(unsigned int address);</source>
<small>In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost. Equality comparisons with a constant can be implemented as an AND gate with some inverted inputs, but less/greater comparisons need to do subtraction, which is much more costly.</small>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
49c324552aa7e7acf37da55ae23dec258f66d9f7
Nios/memenable2
0
172
464
2017-11-01T23:12:18Z
Henry
1
Created page with "You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of four 1 KB..."
wikitext
text/x-wiki
You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of four 1 KB devices. When a memory access to the 4 KB range occurs, only one of the 1 KB devices should be enabled.
Write a function that returns which device should be enabled when an access to the given address occurs. If the access is outside the 4 KB range, return -1. You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
<ul><li>0xfff3000 – 0xfff33ff: Return 0</li>
<li>0xfff3400 – 0xfff37ff: Return 1</li>
<li>0xfff3800 – 0xfff3bff: Return 2</li>
<li>0xfff3c00 – 0xfff3fff: Return 3</li>
<li>Outside 0xfff3000 – 0xfff3fff: Return -1</li></ul>
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
1a43a0902a2d4ac11a786dec10b3fb66db220627
465
464
2017-11-01T23:13:11Z
Henry
1
wikitext
text/x-wiki
You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of four 1 KB devices. When a memory access to the 4 KB range occurs, only one of the 1 KB devices should be enabled.
Write a function that returns which device should be enabled when an access to the given address occurs. If the access is outside the 4 KB range, return -1. You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
<ul><li><tt>0xfff3000 – 0xfff33ff</tt>: Return 0</li>
<li><tt>0xfff3400 – 0xfff37ff</tt>: Return 1</li>
<li><tt>0xfff3800 – 0xfff3bff</tt>: Return 2</li>
<li><tt>0xfff3c00 – 0xfff3fff</tt>: Return 3</li>
<li>Outside <tt>0xfff3000 – 0xfff3fff</tt>: Return -1</li></ul>
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=0
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
46543a3025b24e049a88813dff4d58a5e25c7b21
466
465
2017-11-01T23:23:02Z
Henry
1
wikitext
text/x-wiki
You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of 16 256-byte devices. When a memory access to the 4 KB range occurs, only one of the 1 KB devices should be enabled.
Write a function that returns which device should be enabled when an access to the given address occurs. If the access is outside the 4 KB range, return -1. You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
<ul><li><tt>0xfff3000 – 0xfff30ff</tt>: Return 0</li>
<li><tt>0xfff3100 – 0xfff31ff</tt>: Return 1</li>
<li><tt>0xfff3200 – 0xfff32ff</tt>: Return 2</li>
<li>...etc</li>
<li><tt>0xfff3f00 – 0xfff3fff</tt>: Return 15</li>
<li>Outside <tt>0xfff3000 – 0xfff3fff</tt>: Return -1</li></ul>
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
e5550907bc5c76184c4012f7dfb94fad56dbbbd9
467
466
2017-11-01T23:23:40Z
Henry
1
wikitext
text/x-wiki
You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of 16 256-byte devices. When a memory access to the 4 KB range occurs, only one of the 256-byte devices should be enabled.
Write a function that returns which device should be enabled when an access to the given address occurs. If the access is outside the 4 KB range, return -1. You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (compare equal or not-equal is allowed).
<ul><li><tt>0xfff3000 – 0xfff30ff</tt>: Return 0</li>
<li><tt>0xfff3100 – 0xfff31ff</tt>: Return 1</li>
<li><tt>0xfff3200 – 0xfff32ff</tt>: Return 2</li>
<li>...etc</li>
<li><tt>0xfff3f00 – 0xfff3fff</tt>: Return 15</li>
<li>Outside <tt>0xfff3000 – 0xfff3fff</tt>: Return -1</li></ul>
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
7d48fd969aa81a0f31fe551a874d11120b84b897
468
467
2017-11-01T23:24:32Z
Henry
1
wikitext
text/x-wiki
You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of 16 256-byte devices. When a memory access to the 4 KB range occurs, only one of the 256-byte devices should be enabled.
Write a function that returns which device should be enabled when an access to the given address occurs. If the access is outside the 4 KB range, return -1. You must not use any add, sub, mul, div, or greater/less-than comparisons or conditional branches (equal or not-equal comparisons and branches are allowed).
<ul><li><tt>0xfff3000 – 0xfff30ff</tt>: Return 0</li>
<li><tt>0xfff3100 – 0xfff31ff</tt>: Return 1</li>
<li><tt>0xfff3200 – 0xfff32ff</tt>: Return 2</li>
<li>...etc</li>
<li><tt>0xfff3f00 – 0xfff3fff</tt>: Return 15</li>
<li>Outside <tt>0xfff3000 – 0xfff3fff</tt>: Return -1</li></ul>
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r2=1
|3=
.global _start
_start:
movia r4, 0xff3100
call memenable
1: br 1b # Done
memenable:}}
{{SubmitBox|arch=nios2}}
4a3f73da7e7276077c1d448148a713cb2e8faca9
Nios/pow2
0
173
470
2017-11-01T23:45:12Z
Henry
1
Created page with "Write a function that will return whether its parameter is a power of 2. The parameter is an unsigned integer and will not be 0. <source lang="c">int pow2(unsigned int num);<..."
wikitext
text/x-wiki
Write a function that will return whether its parameter is a power of 2. The parameter is an unsigned integer and will not be 0.
<source lang="c">int pow2(unsigned int num);</source>
{{ExampleBox|1=pow2(4)| 2=r2=1
|3=
.global _start
_start:
movi r4, 4
call pow2
1: br 1b # Done
pow2:}}
{{SubmitBox|arch=nios2}}
68b9fdd1aa4afcc937b665cfed199de8646c3283
Nios/mask
0
174
471
2017-11-02T02:39:29Z
Henry
1
Created page with "A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where the lowest N bits are 1 and the upper 32-N b..."
wikitext
text/x-wiki
A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where the lowest N bits are 1 and the upper 32-N bits are 0.
N will be between 0 and 32.
<source lang="c">unsigned int mask(unsigned int N);</source>
{{ExampleBox|1=mask(4)| 2=r2=0xf
|3=
.global _start
_start:
movi r4, 4
call mask
1: br 1b # Done
mask:}}
{{SubmitBox|arch=nios2}}
ef2a20445213fcfd04f9d3904d21fe7d0dde0656
Nios/mask2
0
175
472
2017-11-02T03:36:11Z
Henry
1
Created page with "A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where bits M (inclusive) to N (exclusive) are 1 (b..."
wikitext
text/x-wiki
A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where bits M (inclusive) to N (exclusive) are 1 (bits are numbered from 0 to 31).
N and M are between 0 and 32. N is guaranteed to be no smaller than M. If N == M, then no bits are set to 1. The special case where M = 0 is equivalent to the previous problem (<vlgstat tc="Nios/mask">mask</vlgstat>)
<source lang="c">unsigned int mask(unsigned int N, unsigned int M);</source>
{{ExampleBox|1=mask(4, 2)| 2=r2=0xc
|3=
.global _start
_start:
movi r4, 4
movi r5, 2
call mask
1: br 1b # Done
mask:}}
{{SubmitBox|arch=nios2}}
efb073b2b3898d4783088a515b562294edaa6316
473
472
2017-11-02T03:38:27Z
Henry
1
wikitext
text/x-wiki
A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where bits M (inclusive) to N (exclusive) are 1 (bits are numbered from 0 to 31).
N and M are between 0 and 32. N is guaranteed to be no smaller than M. If N == M, then no bits are set to 1. The special case where M == 0 is equivalent to the previous problem (<vlgstat tc="Nios/mask">mask</vlgstat>)
<source lang="c">unsigned int mask(unsigned int N, unsigned int M);</source>
{{ExampleBox|1=mask(4, 2)| 2=r2=0xc
|3=
.global _start
_start:
movi r4, 4
movi r5, 2
call mask
1: br 1b # Done
mask:}}
{{SubmitBox|arch=nios2}}
65391be07ec618fbf40d7bb66fd2e8ded0bb4df5
474
473
2017-11-02T03:38:45Z
Henry
1
wikitext
text/x-wiki
A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where bits M (inclusive) to N (exclusive) are 1 (bits are numbered from 0 to 31).
N and M are between 0 and 32. N is guaranteed to be no smaller than M. If N == M, then no bits are set to 1. The special case where M == 0 is equivalent to the previous problem (<vlgstat tc="nios/mask">mask</vlgstat>)
<source lang="c">unsigned int mask(unsigned int N, unsigned int M);</source>
{{ExampleBox|1=mask(4, 2)| 2=r2=0xc
|3=
.global _start
_start:
movi r4, 4
movi r5, 2
call mask
1: br 1b # Done
mask:}}
{{SubmitBox|arch=nios2}}
4cae84afc0d444018eb0477111169d95526f436e
Nios index
0
18
475
406
2017-11-02T03:54:17Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Newly-added problems: I'll sort these soon... ===
==== Declaring memory ====
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
==== Control Flow ====
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
==== Arithmetic ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
==== Memory Operations ====
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
==== Functions ====
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
==== Program Structure ====
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
==== Short Programs ====
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
==== Misc ====
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacehset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
2878e64bb452e274e0235075a86644a6cfdaf5ff
477
475
2017-11-02T03:54:57Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Newly-added problems: I'll sort these soon... ===
==== Declaring memory ====
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
==== Control Flow ====
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
==== Arithmetic ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
==== Memory Operations ====
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
==== Functions ====
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
==== Program Structure ====
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
==== Short Programs ====
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
==== Misc ====
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
c269a2bd0cb49d829111eefcf40383e9c89d6f02
481
477
2017-11-02T06:19:45Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load0">Load</vlgstat>
*<vlgstat tc="nios/load1">Load</vlgstat>
*<vlgstat tc="nios/load2">Load</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Control Flow ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Functions ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== Short Programs ===
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
*<vlgstat tc="nios/normalize">Shift</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
*<vlgstat tc="nios/memtiling">Creating a big memory from many small ones</vlgstat>
876c53aa85efb297cbb4eefd901be072f345aa10
487
481
2017-11-02T06:56:07Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== If-then-else ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
c2cbf4339de33a7f0317504a2500c3babf7d9eff
488
487
2017-11-02T06:56:50Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== If-then-else ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
23e7f88a70e0334ed89273ea8218a715af730aa2
489
488
2017-11-02T06:58:13Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
6c58ef1758512207b7b379c41ad2412fcd3e5927
490
489
2017-11-02T07:00:24Z
Henry
1
/* Functions and recursion */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci callcounting</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
9dc3ebcc5c54d1e24029ed4e067d4aa864e7ff50
491
490
2017-11-02T07:00:50Z
Henry
1
/* Loops and arrays */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci callcounting</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (with overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
2fd481e69170c47245e040f9cb9462a84add0ad7
492
491
2017-11-02T07:01:03Z
Henry
1
/* More Short Programs */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci callcounting</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
254eb1efe045233cf737f1b74f2223e1710ac90b
493
492
2017-11-02T07:01:30Z
Henry
1
/* Loops and arrays */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned memory increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci callcounting</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
258f58efb17dcc64450640ecd2b1818f0093f054
494
493
2017-11-02T07:02:30Z
Henry
1
/* Memory Operations */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci callcounting</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
1bc51e0ba04e4741ea46014440a173925bad89e3
496
494
2017-11-02T07:05:32Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
e2f1359ed63a73841faf1cf6db1db6ca6e7d812a
497
496
2017-11-02T07:13:10Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift</vlgstat>
*<vlgstat tc="nios/shifts">Shift</vlgstat>
*<vlgstat tc="nios/shiftl">Shift</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
f08e675b6cf9d0c90a749631af27e2b6e781d70a
499
497
2017-11-02T07:13:54Z
Henry
1
/* Basic operations */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift logical</vlgstat>
*<vlgstat tc="nios/shifts">Shift arithmetic</vlgstat>
*<vlgstat tc="nios/shiftl">Shift left</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
e7351e8fcf05c6a56424505b9472f21050998163
HDLBits:ProblemMenu
3072
89
476
411
2017-11-02T03:54:35Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Newly-added problems: I'll sort these soon...<ul><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li></ul></li><li>Control Flow<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>Short Programs<ul><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Shift</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li></ul></li><li>Misc<ul><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Creating a big memory from many small ones</vlgstat></li><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
7787406f379407c6c9fa86951c6e919243afac23
478
476
2017-11-02T03:55:04Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Newly-added problems: I'll sort these soon...<ul><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li></ul></li><li>Control Flow<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>Short Programs<ul><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Shift</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li></ul></li><li>Misc<ul><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Creating a big memory from many small ones</vlgstat></li><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
ca258c663bcda6802bd4657bcf3c50d1ce8b3dd9
480
478
2017-11-02T04:00:31Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Newly-added problems: I'll sort these soon...<ul><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li></ul></li><li>Control Flow<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>Short Programs<ul><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Shift</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li></ul></li><li>Misc<ul><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Creating a big memory from many small ones</vlgstat></li><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Declaring Memory<ul><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">String and word</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
751c30f9cc33d796e4c115ca249e64b05d8d3ee5
495
480
2017-11-02T07:03:28Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load from label</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load from pointer</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load from array</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Fibonacci callcounting</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Normalize array</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Multiple memory devices</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Declaring Memory<ul><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">String and word</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
d8227350328aa3ac1c1a2c5b3f871e36a762dc33
498
495
2017-11-02T07:13:21Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load from label</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load from pointer</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load from array</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Normalize array</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Multiple memory devices</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Declaring Memory<ul><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">String and word</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
e6369ee2842de9ddac28173c6da378ac5d1f8522
500
498
2017-11-02T07:14:33Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift logical</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift left</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load from label</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load from pointer</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load from array</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Normalize array</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Multiple memory devices</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li></ul></li><li>Declaring Memory<ul><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">String and word</vlgstat></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load from memory</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned memory increment</vlgstat></li></ul></li><li>Arrays, loops, etc.<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove node</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory (no overlap)</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (with overlap)</vlgstat></li></ul></li><li>Functions<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving and restoring registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li></ul></li></ul>
194a2f830713793774c2b5ca4ca5ef079c48c810
Arm index
0
19
479
274
2017-11-02T04:00:00Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add">Add</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
=== Declaring Memory ===
*<vlgstat tc="arm/declstrword">String and word</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load from memory</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned memory increment</vlgstat>
=== Arrays, loops, etc. ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove node</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memcpy">Copy memory (no overlap)</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory (with overlap)</vlgstat>
=== Functions ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving and restoring registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib3">Number of recursive Fibonacci calls</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
396596114f843959fead85470f83ac8469a17c5e
Nios/tiling
0
135
482
358
2017-11-02T06:29:37Z
Henry
1
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed. The function has four parameters: '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are '''32-bit unsigned''' integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9 × 8 rectangle, 3 × 2 tiles|2=r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{SubmitBox|arch=nios2}}
0e2563305e46aaed731cb6e04b4e6fdd0754c553
483
482
2017-11-02T06:29:46Z
Henry
1
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed. The function has four parameters: '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are '''32-bit unsigned''' integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9 × 8 rectangle, 3 × 2 tiles|2=r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{SubmitBox|arch=nios2}}
3bc92e30b20aa937fb145110d198dba28c5a14c7
501
483
2017-11-02T07:15:26Z
Henry
1
wikitext
text/x-wiki
You are given a rectangle with width '''w''' and height '''h'''. There are also rectangular tiles of width '''w2''' and height '''h2'''. How many columns and rows of these '''w2'''×'''h2''' tiles does it take to completely cover the '''w'''×'''h''' rectangle?
Write a function that computes the number of columns and rows needed. The function has four parameters: '''w''', '''h''', '''w2''', and '''h2'''. Return the number of columns (i.e., in the ''w'' direction) in r2, and the number of rows (in the ''h'' direction) in r3.
The tiles cannot be rotated. The four input parameters are '''32-bit unsigned''' integers. '''w2''' and '''h2''' are guaranteed to not be zero.
{{ExampleBox|9 × 8 rectangle, 3 × 2 tiles|2=r2=3, r3=4|3=
.global _start
_start:
movia r4, 9
movia r5, 8
movia r6, 3
movia r7, 2
call tile
1: br 1b # Done
tile:}}
{{HintBox|This problem should use the division instructions.}}
{{SubmitBox|arch=nios2}}
e72168c58a5f13b4d6bab673e0153a3bbacafa48
Nios/decstr1
0
110
484
322
2017-11-02T06:50:47Z
Henry
1
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The number is guaranteed to fit within an unsigned 32-bit number.
{{ExampleBox|"1234"|2=r2=1234 (or 0x4d2)|3=
# A test case to test your function with
Str: .string "1234"
.global _start
_start:
movia r4, Str
call decstr
br _start # End of testing code
# Parse a decimal string
decstr:
}}
{{SubmitBox|arch=nios2}}
3676accdc09514b904596a5f199089e411f8d5a4
Nios/decstr2
0
111
485
323
2017-11-02T06:51:04Z
Henry
1
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negative number, and the remaining characters are decimal digits. The number is guaranteed to fit within an signed 32-bit number.
{{ExampleBox|"1234"|2=r2=1234 (or 0x4d2)|3=
# A test case to test your function with
Str: .string "1234"
.global _start
_start:
movia r4, Str
call decstr
br _start # End of testing code
# Parse a decimal string
decstr:
}}
{{SubmitBox|arch=nios2}}
8373396ebf17f7079d9e8e20796fab9063a48440
Nios/hexstr
0
109
486
321
2017-11-02T06:53:07Z
Henry
1
wikitext
text/x-wiki
Write a function that converts a 32-bit hexadecimal number into an ASCII character string. For digits 0xa through 0xf, use lower-case ('a' through 'f'). Don't include any leading zeros, but always output at least one digit (so 0x00001000 should print "1000", and 0x00000000 should output "0"). Make sure the output string is null-terminated.
There are two parameters to your function. The first parameter is the location to where you should write the output string. The second parameter is the number to process.
{{ExampleBox|0x12345678|"12345678"|3=
# A test case to test your function with
MyString: .skip 12 # Reserve some space to hold the output string
.global _start
_start:
movia r4, MyString # First parameter: Where to write
movia r5, 0x12345678 # Second parameter: The number to process
call hexstr
br _start # End of testing code
# Convert number to string
hexstr:
}}
{{SubmitBox|arch=nios2}}
ddd9fa8b94717a7907ab04d125f6aec1c634014f
Nios/manhattan
0
158
502
418
2017-11-02T08:34:55Z
Henry
1
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map that indicates the locations of subway stations. You are currently at the center of the map. Find the distance to the closest subway station, measured using [https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1×1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5 x 1 map, the nearest subway station is 1 unit away (to the right). You are at x=2 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
movi r4, 5 # width
movi r5, 1 # height
movia r6, Map # Pointer to 2D char array
call manhattan
1: br 1b # Done
manhattan:}}
{{SubmitBox|arch=nios2}}
30e2f1c8344c40387fc15e086b07cff7bd4e4bce
503
502
2017-11-02T08:35:19Z
Henry
1
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map that indicates the locations of subway stations. You are currently at the center of the map. Find the distance to the closest subway station, measured using [https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1×1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5×1 map, the nearest subway station is 1 unit away (to the right). You are at x=2 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
movi r4, 5 # width
movi r5, 1 # height
movia r6, Map # Pointer to 2D char array
call manhattan
1: br 1b # Done
manhattan:}}
{{SubmitBox|arch=nios2}}
880cdfa7a7d9a2252c466c4113a8906f8cc90aa6
Arm/declword
0
176
504
2017-11-02T20:55:59Z
Henry
1
Created page with "Declare two words of memory, with a label for each one. The word at label <tt>One</tt> should contain the word with value 1, and the word at <tt>Two</tt> should have the value..."
wikitext
text/x-wiki
Declare two words of memory, with a label for each one. The word at label <tt>One</tt> should contain the word with value 1, and the word at <tt>Two</tt> should have the value 2.
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here
}}
{{HintBox|Declarations (creating initialized memory values) is done using assembler directives. The common ones are <tt>.word</tt>, <tt>.hword</tt>, and <tt>.byte</tt>.}}
{{SubmitBox|arch=arm}}
346a149c4a18da9a32723bad76a6637a08ebbb31
Arm/declword4
0
177
505
2017-11-02T21:03:18Z
Henry
1
Created page with "Declare four consecutive half-words of memory. The four half-words should have the values 'y', 'z', 0x61, and 98, respectively. Also create a label named <tt>A</tt> that point..."
wikitext
text/x-wiki
Declare four consecutive half-words of memory. The four half-words should have the values 'y', 'z', 0x61, and 98, respectively. Also create a label named <tt>A</tt> that points to the third half-word (0x61). (In other words, there are two half-words before the label A, and two after.)
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|Declarations made consecutively in the code will be consecutive in memory. Each declaration creates an initialized value at the current location of the assembler's output (It's part of the executable, and not similar to malloc().)}}
{{SubmitBox|arch=arm}}
d4cb1df90fa9ff5255a9a352c3489d3349ac910c
Arm/declblob
0
178
506
2017-11-02T21:04:06Z
Henry
1
Created page with "Declare the following 12 bytes starting at label <tt>Blob</tt> (from low address to high address): <tt>Blob: 01 02 03 04 05 06 07 08 09 0a 0b 0c</tt> This problem only check..."
wikitext
text/x-wiki
Declare the following 12 bytes starting at label <tt>Blob</tt> (from low address to high address):
<tt>Blob: 01 02 03 04 05 06 07 08 09 0a 0b 0c</tt>
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|See if you can declare three .words instead of 12 .bytes.}}
{{SubmitBox|arch=arm}}
ac5bbc80a49be990f505ee62ef40122418b239e9
Arm/declblob2
0
179
507
2017-11-02T21:06:46Z
Henry
1
Created page with "Declare the following 12 bytes (from low address to high address): <tt>01 02 03 04 05 <b>06</b> 07 08 09 0a 0b 0c</tt> Create a label named <tt>Six</tt> that points to the 6..."
wikitext
text/x-wiki
Declare the following 12 bytes (from low address to high address):
<tt>01 02 03 04 05 <b>06</b> 07 08 09 0a 0b 0c</tt>
Create a label named <tt>Six</tt> that points to the 6th byte of the blob. In addition, make sure the label <tt>Six</tt> is at 0x1000 bytes after the beginning of the <tt>.data</tt> section. (This implies that the entire 12 bytes of data need to be moved).
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{HintBox|The .org directive changes the current output location within the section.}}
{{SubmitBox|arch=arm}}
d4b0ca1d9bf53b9b8f47dde34d41c748d6e21138
Arm/declstruct
0
180
508
2017-11-03T20:53:38Z
Henry
1
Created page with "Consider the following struct: <source lang="c"> struct { char postal_code[7]; unsigned short area_code; };</source> Declare an array of three of these structs starti..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">
struct {
char postal_code[7];
unsigned short area_code;
};</source>
Declare an array of three of these structs starting at location <tt>List</tt>, initialized to the following:
<source lang="c">{ "M5S3G4", 416 }, { "V6T1Z4", 604 }, { "K7L3N6", 613 }</source>
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
# Insert declarations here}}
{{SubmitBox|arch=arm}}
a090e4136d15f3d66dd5eebf6f1554f05edbd83c
Arm/declequ
0
181
509
2017-11-03T20:59:27Z
Henry
1
Created page with "The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers. Using <tt>.equ</tt>, declare a co..."
wikitext
text/x-wiki
The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers.
Using <tt>.equ</tt>, declare a constant named LEDS with value 0xff200000 (This is the location of the LED I/O device). Then write a function named <tt>get_led</tt> that returns the value of LEDs in r2. (This is just 32-bit-move-constant (ldr reg, =NUM) to practice using the constant.)
{{ExampleBox|[No input]|2=r2=0xff200000 |3=
# Insert declarations here
.global get_led
# A function that returns the value of LEDS
get_led:
}}
{{SubmitBox|arch=nios2}}
457dd458213aed6acce49de535f8a55f21d4cb6f
510
509
2017-11-03T20:59:33Z
Henry
1
wikitext
text/x-wiki
The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers.
Using <tt>.equ</tt>, declare a constant named LEDS with value 0xff200000 (This is the location of the LED I/O device). Then write a function named <tt>get_led</tt> that returns the value of LEDs in r2. (This is just 32-bit-move-constant (ldr reg, =NUM) to practice using the constant.)
{{ExampleBox|[No input]|2=r2=0xff200000 |3=
# Insert declarations here
.global get_led
# A function that returns the value of LEDS
get_led:
}}
{{SubmitBox|arch=arm}}
2873630dc003512a2776c17c67d8164e67c94eb2
511
510
2017-11-03T20:59:50Z
Henry
1
wikitext
text/x-wiki
The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers.
Using <tt>.equ</tt>, declare a constant named LEDS with value 0xff200000 (This is the location of the LED I/O device). Then write a function named <tt>get_led</tt> that returns the value of LEDs in r2. (This is just 32-bit-move-constant (ldr reg, =NUM) to practice using the constant.)
{{ExampleBox|[No input]|2=r2=0xff200000 |3=
// Insert declarations here
.global get_led
// A function that returns the value of LEDS
get_led:
}}
{{SubmitBox|arch=arm}}
1a4fa611be2f629dde97279032ba30187e2a56b4
Arm/declequ2
0
182
512
2017-11-03T21:11:37Z
Henry
1
Created page with "In this problem, the constant <tt>STARTVAL</tt> has been declared (and declared as .global so you can use it). Declare 4 words beginning at label <tt>Nums</tt>, with values..."
wikitext
text/x-wiki
In this problem, the constant <tt>STARTVAL</tt> has been declared (and declared as .global so you can use it).
Declare 4 words beginning at label <tt>Nums</tt>, with values STARTVAL, STARTVAL+1, ... , STARTVAL+3.
{{ExampleBox|[No input]|[No output]|3=
// Insert declarations here}}
{{SubmitBox|arch=arm}}
9de25d44961ff996a179297dcbfbd0e5b803c5cd
Arm/declstruct2
0
183
513
2017-11-03T23:43:44Z
Henry
1
Created page with "Consider the following struct: <source lang="c"> struct Node { Node *c1; Node *c2; int name };</source> Each Node has a name, and can point to up to two other Nod..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">
struct Node {
Node *c1;
Node *c2;
int name
};</source>
Each Node has a name, and can point to up to two other Nodes. A set of these Nodes can be used to represent a tree or a graph (with up to two outgoing edges per node).
Declare five instances of Node to represent the following 5-node binary tree. The node names are labelled in each box. If a node's outgoing edge is unused, initialize the pointer to 0. Label the root node (named 0) with the label <tt>Root</tt>.
[[File:Declstruct2.png]]
This problem only checks for the declaration. There is no code.
{{ExampleBox|[No input]|[No output] |3=
// Insert declarations here}}
{{SubmitBox|arch=arm}}
202ccd10f15b83eb316c07c4a738bddd27e18b15
Arm/declstring
0
184
514
2017-11-04T04:20:20Z
Henry
1
Created page with "Declare a string at the label <tt>Hello</tt>: "This is a string" This problem only checks for the declaration. There is no code. '''ARMv7 quirk''': Declare the string in the..."
wikitext
text/x-wiki
Declare a string at the label <tt>Hello</tt>: "This is a string"
This problem only checks for the declaration. There is no code.
'''ARMv7 quirk''': Declare the string in the '''.data''' section. The assembler seems to truncate the '''.text''' section to a multiple of 4 bytes in length, causing the final few bytes of the program to disappear, if the total length of the '''.text''' section isn't a multiple of 4.
{{ExampleBox|[No input]|[No output] |3=
// Insert declarations here}}
{{HintBox|Strings are null-terminated. This is usually handled for you (depending on which directive you use to create the string).)}}
{{SubmitBox|arch=arm}}
5ffbc7410204bf07500224849959482222d1500e
Arm/signext
0
185
515
2017-11-04T04:32:45Z
Henry
1
Created page with "Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input..."
wikitext
text/x-wiki
Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
{{ExampleBox|0xf0|0xfffffff0|3=
// A test case to test your function with
.global _start
_start:
mov r4, #0xf0 // First parameter is always in r4
bl signext
b _start // End of testing code
// A function to sign extend. Only this part will be tested.
signext:
}}
{{SubmitBox|arch=arm}}
8a2116ebc218051a35ded336d5942c64587cdb98
Arm/zeroext
0
186
516
2017-11-04T04:43:36Z
Henry
1
Created page with "Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input..."
wikitext
text/x-wiki
Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
{{ExampleBox|0xf0|0x000000f0|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0xf0 // First parameter is always in r4
bl zeroext
b _start // End of testing code
// A function to zero extend. Only this part will be tested.
zeroext:
}}
{{SubmitBox|arch=arm}}
79f5f104b0b7ab4c8dbfc218dfdb2ab9ace75ba8
Arm/extend
0
187
517
2017-11-04T05:30:44Z
Henry
1
Created page with "Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r0). The first function parameter (in r0) specifies which oper..."
wikitext
text/x-wiki
Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r0). The first function parameter (in r0) specifies which operation to do, while the second parameter holds the number to extend:
<ul><li>r0 = 0: Zero extend 8 bit to 32 bit</li>
<li>r0 = 1: Zero extend 16 bit to 32 bit</li>
<li>r0 = 2: Sign extend 8 bit to 32 bit</li>
<li>r0 = 3: Sign extend 16 bit to 32 bit</li>
</ul>
{{ExampleBox|extend(2,0xf0)|2=r0=0xfffffff0|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =2 // 2 = sign extend 8->32
ldr r1, =0xf0 // The number to extend
bl extend
b _start // End of testing code
// A function to extend. Only this part will be tested.
extend:
}}
{{SubmitBox|arch=arm}}
d690cf2380743b85fbf9acfe87165e44716fe7fe
518
517
2017-11-04T05:46:56Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r0). The first function parameter (in r0) specifies which operation to do, while the second parameter holds the number to extend:
<ul><li>r0 = 0: Zero extend 8 bit to 32 bit</li>
<li>r0 = 1: Zero extend 16 bit to 32 bit</li>
<li>r0 = 2: Sign extend 8 bit to 32 bit</li>
<li>r0 = 3: Sign extend 16 bit to 32 bit</li>
</ul>
{{ExampleBox|extend(2,0xf0)|2=r0=0xfffffff0|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =2 // 2 = sign extend 8->32
ldr r1, =0xf0 // The number to extend
bl extend
b _start // End of testing code
// A function to extend. Only this part will be tested.
extend:
}}
{{HintBox|The BIC (bit clear) instruction may be useful.}}
{{SubmitBox|arch=arm}}
9257096ac4e9e30040c5530e73528d00926b47cd
Arm/saturate
0
188
519
2017-11-04T05:52:30Z
Henry
1
Created page with "Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around. Write a function that wil..."
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around.
Write a function that will convert an unsigned 32-bit number to 16 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the maximum possible unsigned 16-bit value.
{{ExampleBox|0x12345|0xffff|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x12345 // First parameter is always in r4
bl saturate
b _start // End of testing code
// Convert unsigned 32 bit to 16 bit, with saturation
saturate:
}}
{{SubmitBox|arch=arm}}
22d1d3d0c6b9d82c0050f168f68f6c3ba20cf050
Arm/saturate2
0
189
520
2017-11-04T05:55:58Z
Henry
1
Created page with "Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around. Write a functio..."
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around.
Write a function that will convert a signed 32-bit number to (signed) 8 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the closest possible signed 8-bit value. Since the output is an 8 bit value, the upper 24 bits of the return value should be zero.
{{ExampleBox|0x123|0x7f|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x123 // First parameter is always in r4
bl saturate
b _start // End of testing code
// Convert signed 32 bit to 8 bit, with saturation
saturate:
}}
{{SubmitBox|arch=arm}}
f70d14623690ac2e52cba9cdcd6265c4fae749a7
Arm/bcd2
0
190
521
2017-11-04T07:02:50Z
Henry
1
Created page with "Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represen..."
wikitext
text/x-wiki
Binary-coded decimal is a method to represent decimal numbers encoded into binary. It uses each group of 4 bits (which can normally represent numbers from 0 to 15) to represent one decimal digit (of values 0 to 9). Thus, the number 10 (or 0xa) is encoded in BCD as 0x10.
Write a function that converts a number into its BCD representation. You are guaranteed that the input number will be between 0 and 15.
{{ExampleBox|10|0x10|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =10 // First parameter is always in r0
bl bcd
b _start // End of testing code
// Convert a number to BCD representation
bcd:
}}
{{SubmitBox|arch=arm}}
dd5849d439b8a603522cae358294ffaed17b46ac
Arm/hex1
0
191
522
2017-11-04T07:03:53Z
Henry
1
Created page with "Write a function that converts a one-digit hexadecimal number (0 to 15) into an ASCII character suitable for printing the number. For 0xa through 0xf, use lower-case ('a' thro..."
wikitext
text/x-wiki
Write a function that converts a one-digit hexadecimal number (0 to 15) into an ASCII character suitable for printing the number. For 0xa through 0xf, use lower-case ('a' through 'f'). You are guaranteed that the input number will be between 0 and 15.
{{ExampleBox|0xa|'a'|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0xa // First parameter is always in r0
bl hex1
b _start // End of testing code
// Print one hex digit
hex1:
}}
{{SubmitBox|arch=arm}}
a5b17ffc3ee00470cf1ce63b77656053a97aaa42
Arm/hexstr
0
192
523
2017-11-04T07:18:18Z
Henry
1
Created page with "Write a function that converts a 32-bit hexadecimal number into an ASCII character string. For digits 0xa through 0xf, use lower-case ('a' through 'f'). Don't include any lead..."
wikitext
text/x-wiki
Write a function that converts a 32-bit hexadecimal number into an ASCII character string. For digits 0xa through 0xf, use lower-case ('a' through 'f'). Don't include any leading zeros, but always output at least one digit (so 0x00001000 should print "1000", and 0x00000000 should output "0"). Make sure the output string is null-terminated.
There are two parameters to your function. The first parameter is the location to where you should write the output string. The second parameter is the number to process.
{{ExampleBox|0x12345678|"12345678"|3=
// A test case to test your function with
MyString: .skip 12 # Reserve some space to hold the output string
.global _start
_start:
ldr r0, =MyString // First parameter: Where to write
ldr r1, =0x12345678 // Second parameter: The number to process
bl hexstr
b _start // End of testing code
// Convert number to string
hexstr:
}}
{{SubmitBox|arch=arm}}
d28113332d6f0cbe57ceb17d0ba814c20c256848
524
523
2017-11-04T07:20:06Z
Henry
1
wikitext
text/x-wiki
Write a function that converts a 32-bit hexadecimal number into an ASCII character string. For digits 0xa through 0xf, use lower-case ('a' through 'f'). Don't include any leading zeros, but always output at least one digit (so 0x00001000 should print "1000", and 0x00000000 should output "0"). Make sure the output string is null-terminated.
There are two parameters to your function. The first parameter is the location to where you should write the output string. The second parameter is the number to process.
{{ExampleBox|0x12345678|"12345678"|3=
// A test case to test your function with
MyString: .skip 12 // Reserve some space to hold the output string
.global _start
_start:
ldr r0, =MyString // First parameter: Where to write
ldr r1, =0x12345678 // Second parameter: The number to process
bl hexstr
b _start // End of testing code
// Convert number to string
hexstr:
}}
{{SubmitBox|arch=arm}}
7bb60334ebf2d6b68007c8d2513328769b16dcb0
Arm/decstr1
0
193
525
2017-11-04T07:26:50Z
Henry
1
Created page with "Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The number is guaranteed to fit within an unsigned..."
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The number is guaranteed to fit within an unsigned 32-bit number.
{{ExampleBox|"1234"|2=r0=1234 (or 0x4d2)|3=
// A test case to test your function with
Str: .string "1234"
.global _start
_start:
ldr r0, =Str
bl decstr
b _start // End of testing code
// Parse a decimal string
decstr:
}}
{{SubmitBox|arch=arm}}
b60bd2022ad7721b514fb1baee60e85aa72b10f9
Arm/decstr2
0
194
526
2017-11-04T07:39:33Z
Henry
1
Created page with "Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negativ..."
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negative number, and the remaining characters are decimal digits. The number is guaranteed to fit within an signed 32-bit number.
{{ExampleBox|"1234"|2=r0=1234 (or 0x4d2)|3=
decstr:// A test case to test your function with
Str: .string "1234"
.global _start
_start:
ldr r0, =Str
bl decstr
b _start // End of testing code
// Parse a decimal string
decstr:
}}
{{SubmitBox|arch=arm}}
7b67de3e9d65aa6dbaebd57936395be8810751e8
527
526
2017-11-04T07:40:15Z
Henry
1
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negative number, and the remaining characters are decimal digits. The number is guaranteed to fit within an signed 32-bit number.
{{ExampleBox|"1234"|2=r0=1234 (or 0x4d2)|3=
// A test case to test your function with
Str: .string "1234"
.global _start
_start:
ldr r0, =Str
bl decstr
b _start // End of testing code
// Parse a decimal string
decstr:
}}
{{SubmitBox|arch=arm}}
0602cc5672bd790e925838b5d59b1fa752250539
Arm/maxs8
0
195
528
2017-11-04T07:47:16Z
Henry
1
Created page with "Write a function that returns the maximum value out of an array of 8-bit signed bytes. The function has two parameters. The first parameter is the length of the array (at lea..."
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 8-bit signed bytes.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r0=3|3=
// A test case to test your function with
Array: .byte 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl max
b _start // End of testing code
// Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=arm}}
fb170438190954d6591f589571e7aaa7877bf153
529
528
2017-11-04T08:01:52Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 8-bit signed bytes.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r0=3|3=
// A test case to test your function with
.data
Array: .byte 1, 2, 3
.text
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl max
b _start // End of testing code
// Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=arm}}
f4f6cd16918539e3a427712b0ac4fd3b1da5d439
Arm/mins
0
196
530
2017-11-04T08:08:54Z
Henry
1
Created page with "Write a function that returns the minimum value out of an array of 32-bit signed words. The function has two parameters. The first parameter is the length of the array (at le..."
wikitext
text/x-wiki
Write a function that returns the minimum value out of an array of 32-bit signed words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r0=1|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl min
b _start // End of testing code
// Return minimum element of signed array
min:
}}
{{SubmitBox|arch=arm}}
7e5484e23c1bdcfa16e94e46abbd616cc5ab60de
Arm/maxu
0
197
531
2017-11-04T08:10:46Z
Henry
1
Created page with "Write a function that returns the maximum value out of an array of 32-bit unsigned words. The function has two parameters. The first parameter is the length of the array (at..."
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 32-bit unsigned words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r0=3|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl max
b _start // End of testing code
// Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=arm}}
ae66eb323018668e19912d576802b81cb2c412b7
532
531
2017-11-04T08:11:45Z
Henry
1
Henry moved page [[Arm/maxu.tc]] to [[Arm/maxu]] without leaving a redirect
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 32-bit unsigned words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r0=3|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl max
b _start // End of testing code
// Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=arm}}
ae66eb323018668e19912d576802b81cb2c412b7
Arm/bswap
0
198
533
2017-11-04T08:26:02Z
Henry
1
Created page with "When communicating multi-byte (hword or word) values between machines of different endianness, it is sometimes necessary to swap the byte ordering. Write a function that will..."
wikitext
text/x-wiki
When communicating multi-byte (hword or word) values between machines of different endianness, it is sometimes necessary to swap the byte ordering. Write a function that will reverse the byte ordering in a 32-bit word. (Note that only bytes are swapped. The 8 bits within each byte are still in the same order.)
The function has one parameter: The input number.
{{ExampleBox|0x11223344|2=r0=0x44332211|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x11223344
bl bswap
b _start // End of testing code
// Byte swap
bswap:
}}
{{HintBox|The <tt>rev</tt> instruction may be useful.}}
{{SubmitBox|arch=arm}}
f6165f6e9a4992867a174a09aa5caf828d094068
Arm/bits1
0
199
534
2017-11-04T19:35:31Z
Henry
1
Created page with "An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given num..."
wikitext
text/x-wiki
An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given number, in unsigned binary representation.
{{ExampleBox|0x1000|2=r0=13|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{SubmitBox|arch=nios2}}
e4abaaff65907e950fafb4500cb353a852f96e58
535
534
2017-11-04T19:35:39Z
Henry
1
wikitext
text/x-wiki
An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given number, in unsigned binary representation.
{{ExampleBox|0x1000|2=r0=13|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{SubmitBox|arch=arm}}
558a08b1ab4e6e695b6c47fbf9055d08f4f78697
536
535
2017-11-04T20:25:01Z
Henry
1
wikitext
text/x-wiki
An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given number, in unsigned binary representation.
{{ExampleBox|0x1000|2=r0=13|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|The <tt>CLZ</tt> (count leading zeros) instruction may be useful.}}
{{SubmitBox|arch=arm}}
edf3ff96787aa71cac41c708b11a18511f1a813d
Arm/bits2
0
200
537
2017-11-04T20:39:50Z
Henry
1
Created page with "A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits..."
wikitext
text/x-wiki
A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits are needed to represent a given number, in signed binary representation.
{{ExampleBox|0x1000|2=r0=13|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|Think carefully about corner cases...}}
{{SubmitBox|arch=arm}}
e7262903adf11499ebb45b100a4c76da874cad44
Arm/shiftu
0
201
538
2017-11-04T20:45:58Z
Henry
1
Created page with "One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the..."
wikitext
text/x-wiki
One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the information about the audio sample.
For this problem, write a function (named shift) that converts one unsigned 32-bit audio sample to unsigned 8-bit format, and returns the converted sample. As a result, the least-significant 24 bits of the sample are lost (truncation). Don't do any rounding.
{{ExampleBox|0x12345678|2=0x12|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x12345678
bl shift
b _start // End of testing code
// Convert one U32 sample to U8 format
shift:
}}
{{SubmitBox|arch=arm}}
a41ce42f5e22a62c82ae1d07f5cd6bc1f19a20ef
Arm/shifts
0
202
539
2017-11-04T20:47:55Z
Henry
1
Created page with "One common case where you need to shift and truncate numbers is when changing the amplitude of audio samples. For this problem, write a function (named shift) that will accep..."
wikitext
text/x-wiki
One common case where you need to shift and truncate numbers is when changing the amplitude of audio samples.
For this problem, write a function (named shift) that will accept a 32-bit signed audio sample, and return a 32-bit signed audio sample with 1/4 of the amplitude. Don't do any rounding (just shift and truncate).
{{ExampleBox|0x40000|2=0x10000|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x40000
bl shift
b _start // End of testing code
// Return 1/4 amplitude for a S32 sample
shift:
}}
{{SubmitBox|arch=arm}}
df0454f50450eff397738b12f663bf88ede96470
Arm/shiftl
0
203
540
2017-11-04T20:50:52Z
Henry
1
Created page with "One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the..."
wikitext
text/x-wiki
One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the information about the audio sample.
For this problem, write a function (named shift) that converts one signed 16-bit audio sample to signed 32-bit format, and returns the converted sample. (This is equivalent to increasing the amplitude by 65536 times.) As a result of the conversion, the low 16 bits of the result become zero.
{{ExampleBox|0x1234|2=0x12340000|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1234
bl shift
b _start // End of testing code
// Convert one S16 to S32 format
shift:
}}
{{SubmitBox|arch=arm}}
187691a284c8137bdb0f479348a11f3e497541c0
Arm/normalize
0
204
541
2017-11-05T00:07:03Z
Henry
1
Created page with "Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then..."
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r4: The number of elements in the input (and output) array</li>
<li>r5: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r6: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
There is no return value.
<source lang="c">void normalize(unsigned int length, const unsigned int *input, unsigned int *output);</source>
You may wish to reuse your solutions to <vlgstat tc="arm/maxu"/> and <vlgstat tc="arm/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
// A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
ldr r0, =4
ldr r1, =Input
ldr r2, =Output
bl normalize
b _start // End of testing code
// Normalize to U16
normalize:
}}
{{SubmitBox|arch=arm}}
618cdbb19ecee95f9b2e99f74bc70e6c284bd6d6
Nios/normalize
0
121
542
335
2017-11-05T00:11:48Z
Henry
1
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r4: The number of elements in the input (and output) array</li>
<li>r5: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r6: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
There is no return value.
<source lang="c">void normalize(unsigned int length, const unsigned int *input, unsigned int *output);</source>
You may wish to reuse your solutions to <vlgstat tc="nios/maxu"/> and <vlgstat tc="nios/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
# A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
movia r4, 4
movia r5, Input
movia r6, Output
call normalize
br _start # End of testing code
# Normalize to U16
normalize:
}}
{{SubmitBox|arch=nios2}}
1e69c50e7405fe78aa4fec812e8d0f1fb9af3c4b
Nios/peak
0
122
543
336
2017-11-05T00:13:28Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the peak-to-peak amplitude of a signal stored in an array of 32-bit signed words. This is the difference between the maximum and minimum samples.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
{{ExampleBox|[1, 2, 3]|2=r2=2|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call peak
br _start # End of testing code
# Return the difference between max and min array elements
peak:
}}
{{SubmitBox|arch=nios2}}
11c7332bb3915cb9be7fb2f0602e1ed3e18f0586
544
543
2017-11-05T00:25:56Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the peak-to-peak amplitude of a signal stored in an array of 32-bit signed words. This is the difference between the maximum and minimum samples.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">unsigned int peak(unsigned int length, int *array);</source>
{{ExampleBox|[1, 2, 3]|2=r2=2|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call peak
br _start # End of testing code
# Return the difference between max and min array elements
peak:
}}
{{SubmitBox|arch=nios2}}
7e9ec8b0b322a878099d294b7832d4b7fcb4baf5
Arm/peak
0
205
545
2017-11-05T00:26:01Z
Henry
1
Created page with "Write a function that returns the peak-to-peak amplitude of a signal stored in an array of 32-bit signed words. This is the difference between the maximum and minimum samples...."
wikitext
text/x-wiki
Write a function that returns the peak-to-peak amplitude of a signal stored in an array of 32-bit signed words. This is the difference between the maximum and minimum samples.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">unsigned int peak(unsigned int length, int *array);</source>
{{ExampleBox|[1, 2, 3]|2=r0=2|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl peak
b _start // End of testing code
// Return the difference between max and min array elements
peak:
}}
{{SubmitBox|arch=arm}}
12fd3e51c15829eb5f5f10b00a0cb61ada5d5bb7
Arm/arraysum
0
206
546
2017-11-05T01:03:24Z
Henry
1
Created page with "Write a function that returns the sum of all elements of an array of 32-bit (signed) words. The function has two parameters. The first parameter is a pointer to the start of..."
wikitext
text/x-wiki
Write a function that returns the sum of all elements of an array of 32-bit (signed) words.
The function has two parameters. The first parameter is a pointer to the start of the array. The second parameter is the length of the array (at least 1).
{{ExampleBox|[1, 2, 3]|2=r0=6|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =Array
ldr r1, =3
bl arraysum
b _start // End of testing code
// Sum elements of array
arraysum:
}}
{{SubmitBox|arch=arm}}
d37bfcd5292d262a85778067f9088e0539a8a823
Arm/subarraysum
0
207
547
2017-11-05T01:38:53Z
Henry
1
Created page with "The maximum subarray sum algorithm returns the biggest sum of the elements of any subarray of a given array. A subarray consists of consecutive elements of an array (a subarra..."
wikitext
text/x-wiki
The maximum subarray sum algorithm returns the biggest sum of the elements of any subarray of a given array. A subarray consists of consecutive elements of an array (a subarray is not the same as a subsequence).
For example, consider the following array:
<tt>[ -1, -1, <b>3, -1, 3</b>, -2 ]</tt>
There are many subarrays of this array. A subarray may include the entire array. A subarray cannot be empty. In this example, the subarray that gives the largest sum is [3, -1, 3] (3rd through 5th elements), with a sum of 5.
Write a function that returns the maximum subarray sum for a given array of 32-bit signed words. (This problem doesn't make sense with unsigned words, because if all elements were non-negative, you'd always include all of them to get the biggest sum.)
The function has two parameters. The first parameter is a pointer to the start of the array. The second parameter is the length of the array (at least 1).
You may wish to reuse your solution from <vlgstat tc="arm/arraysum"/>. A O(n<sup>3</sup>) solution is acceptable here. O(n<sup>2</sup>) isn't difficult, and O(n) is possible.
{{ExampleBox|[-1, -1, 3, -1, 3, -2]|2=r0=5|3=
// A test case to test your function with
Array: .word -1, -1, 3, -1, 3, -2
.global _start
_start:
ldr r0, =Array
ldr r1, =6
bl subarraysum
b _start // End of testing code
// Sum elements of array
subarraysum:
}}
{{SubmitBox|arch=arm}}
61f4a3debbc2ed0110c0613a951872e04ff901fc
MediaWiki:Sidebar
8
4
548
269
2017-11-05T18:00:57Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** http://cpulator.01xz.net/|Run a Simulation (Nios II)
** http://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** http://01xz.net/|01xz.net Home
** http://hdlbits.01xz.net/|HDLBits — Verilog practice
** http://asmbits.01xz.net/|ASMBits — Assembly language practice
** http://cpulator.01xz.net/|CPUlator — Nios II simulator
** http://cpulator.01xz.net/arm|CPUlator — ARMv7 simulator
* SEARCH
* TOOLBOX
* LANGUAGES
fbc541c6e34bc413d35672ad028fcbaccb04ee90
Nios/load0
0
125
549
342
2017-11-05T21:06:35Z
Henry
1
wikitext
text/x-wiki
There is a 32-bit word located at memory location labelled with the label <tt>Data</tt>. Write a function that reads this word from memory and returns it. Note that the function has no parameters.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox|No input to function.
|2=r2=0x123|3=
#Data: .word 0x123 # Uncomment for debugging
.global _start
_start:
call load
1: br 1b # Done
load:}}
{{SubmitBox|arch=nios2}}
424ae270c3921d279525531f369a2a8646a6ec9c
Arm/load0
0
208
550
2017-11-05T21:23:25Z
Henry
1
Created page with "There is a 32-bit word located at memory location labelled with the label <tt>Data</tt>. Write a function that reads this word from memory and returns it. Note that the functi..."
wikitext
text/x-wiki
There is a 32-bit word located at memory location labelled with the label <tt>Data</tt>. Write a function that reads this word from memory and returns it. Note that the function has no parameters.
<syntaxhighlight lang="c">int load ();</syntaxhighlight>
{{ExampleBox|No input to function.
|2=r0=0x123|3=
//Data: .word 0x123 // Uncomment for debugging
.global _start
_start:
bl load
1: b 1b // Done
load:}}
{{SubmitBox|arch=arm}}
3f73470ca654d400c78f6662c4c5a88d259c0b87
Nios/load1
0
126
551
343
2017-11-05T21:53:53Z
Henry
1
wikitext
text/x-wiki
Your function will be passed a pointer to a 32-bit word. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer);</syntaxhighlight>
{{ExampleBox|1=r4=Data
|2=r2=0x123|3=
Data: .word 0x123
.global _start
_start:
movia r4, Data
call load
1: br 1b # Done
# Dereference a pointer
load:}}
{{SubmitBox|arch=nios2}}
2067d03181d5c68a7b292d98d8cc5a1b5d2c2465
Arm/load1
0
209
552
2017-11-05T21:55:05Z
Henry
1
Created page with "Your function will be passed a pointer to a 32-bit word. Write a function that reads this word from memory and returns it. <syntaxhighlight lang="c">int load (int *pointer);<..."
wikitext
text/x-wiki
Your function will be passed a pointer to a 32-bit word. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer);</syntaxhighlight>
{{ExampleBox|1=r4=Data
|2=r2=0x123|3=
Data: .word 0x123
.global _start
_start:
ldr r0, =Data
bl load
1: b 1b // Done
// Dereference a pointer
load:}}
{{SubmitBox|arch=arm}}
4dd97af923683865729feb8f3ee7bbd5e8d35248
Arm/load2
0
210
553
2017-11-05T21:57:43Z
Henry
1
Created page with "Your function will be passed a pointer to the start of an array of 32-bit words, and an array index. Write a function that reads the index<sup>th</sup> word from memory and re..."
wikitext
text/x-wiki
Your function will be passed a pointer to the start of an array of 32-bit words, and an array index. Write a function that reads the index<sup>th</sup> word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer, int index);</syntaxhighlight>
{{ExampleBox|1=r4=Data, r5=1
|2=r2=0x124|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
ldr r0, =Data
ldr r1, =1
bl load
1: b 1b // Done
// Dereference a pointer
load:}}
{{SubmitBox|arch=nios2}}
be233cd736069cb24fb4c0fc46260be1029e9c00
Arm/swap
0
211
554
2017-11-05T22:11:03Z
Henry
1
Created page with "Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third p..."
wikitext
text/x-wiki
Write a function that will swap two array elements. Your function will be passed three parameters: The first is a pointer to the beginning of the array. The second and third parameters are indexes to specify which pair of elements of the array should be swapped.
<syntaxhighlight lang="c">int swap (int *pointer, int index1, int index2);</syntaxhighlight>
{{ExampleBox|1=r0=Data, r1=0, r2=2
|2=[Two array elements swapped]|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
ldr r0, =Data
ldr r1, =0
ldr r2, =2
bl swap
1: b 1b // Done
// Swap two array elements
swap:}}
{{SubmitBox|arch=arm}}
4239ac84e4220b7b22793b50ab0ad3f0f7b22179
Arm/chrcpy
0
212
555
2017-11-05T22:12:51Z
Henry
1
Created page with "Write a function that will copy one character from a string to a second string. Your function will be passed four parameters: The first two parameters specify the source strin..."
wikitext
text/x-wiki
Write a function that will copy one character from a string to a second string. Your function will be passed four parameters: The first two parameters specify the source string and character position. The third and fourth parameters specify the destination string and character position. Copy the character. (Don't consider null-termination, overflows, etc.)
<syntaxhighlight lang="c">int chrcpy (char *src, int src_pos, char *dst, int dst_pos);</syntaxhighlight>
{{ExampleBox|chrcpy("hello", 1, "bye", 1)|
|2="bye" -> "bee"|3=
.data
Src: .string "hello"
.align 2 // Insert padding so it's easier to read.
Dst: .string "bye"
.text
.global _start
_start:
ldr r0, =Src
ldr r1, =1
ldr r2, =Dst
ldr r2, =1
bl chrcpy
1: b 1b // Done
// Copy a character from one string to another
chrcpy:}}
{{SubmitBox|arch=arm}}
02f8d81a6b263d0f4cc04741923a72f52d4f49e3
Arm/loaddecl1
0
213
556
2017-11-05T22:18:26Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="text"> ldr r0, =Data ldr r1, [r1, #4] ldrh r2, [r1, #8] ldrb r3, [r1, #11] </syntaxhighlight> Declare some d..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="text">
ldr r0, =Data
ldr r1, [r1, #4]
ldrh r2, [r1, #8]
ldrb r3, [r1, #11]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul><li>r1 = 0x1234</li>
<li>r2 = 0x5678</li>
<li>r3 = 0x90</li></ul>
{{ExampleBox|[None]|2=r1=0x1234, r2=0x5678, r3=0x90 |3=
# Declare something
Data:
.global _start
_start:
ldr r0, =Data
ldr r1, [r1, #4]
ldrh r2, [r1, #8]
ldrb r3, [r1, #11]
1: br 1b # Done
}}
{{SubmitBox|arch=arm}}
22cadd4fc447e0e85cb1971809589d9767f66290
557
556
2017-11-05T22:19:24Z
Henry
1
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="text">
ldr r0, =Data
ldr r1, [r1, #4]
ldrh r2, [r1, #8]
ldrb r3, [r1, #11]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul><li>r1 = 0x1234</li>
<li>r2 = 0x5678</li>
<li>r3 = 0x90</li></ul>
{{ExampleBox|[None]|2=r1=0x1234, r2=0x5678, r3=0x90 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r0, =Data
ldr r1, [r1, #4]
ldrh r2, [r1, #8]
ldrb r3, [r1, #11]
1: b 1b // Done
}}
{{SubmitBox|arch=arm}}
954ef3dbe9485fcc468b3a1546f555fc6ada07e6
559
557
2017-11-05T22:19:45Z
Henry
1
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="text">
ldr r0, =Data
ldr r1, [r1, #4]
ldrh r2, [r1, #8]
ldrb r3, [r1, #11]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul><li>r1 = 0x1234</li>
<li>r2 = 0x5678</li>
<li>r3 = 0x90</li></ul>
{{ExampleBox|[None]|2=r1=0x1234, r2=0x5678, r3=0x90 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r0, =Data
ldr r1, [r1, #4]
ldrh r2, [r1, #8]
ldrb r3, [r1, #11]
1: b 1b // Done
}}
{{SubmitBox|arch=arm}}
eb2afbe2f4d005a3de41b7b55c2ae7d53c4ff6f0
560
559
2017-11-05T22:20:48Z
Henry
1
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="text">
ldr r0, =Data
ldr r1, [r0, #4]
ldrh r2, [r0, #8]
ldrb r3, [r0, #11]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul><li>r1 = 0x1234</li>
<li>r2 = 0x5678</li>
<li>r3 = 0x90</li></ul>
{{ExampleBox|[None]|2=r1=0x1234, r2=0x5678, r3=0x90 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r0, =Data
ldr r1, [r0, #4]
ldrh r2, [r0, #8]
ldrb r3, [r0, #11]
1: b 1b // Done
}}
{{SubmitBox|arch=arm}}
244efc23155e498646378e20771ddbddd31bddb3
Nios/loaddecl1
0
130
558
349
2017-11-05T22:19:33Z
Henry
1
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">movia r5, Data
ldw r2, 4(r5)
ldhu r3, 8(r5)
ldbu r4, 11(r5)
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul><li>r2 = 0x1234</li>
<li>r3 = 0x5678</li>
<li>r4 = 0x90</li></ul>
{{ExampleBox|[None]|2=r2=0x1234, r3=0x5678, r4=0x90 |3=
# Declare something
.global _start
_start:
movia r5, Data
ldw r2, 4(r5)
ldhu r3, 8(r5)
ldbu r4, 11(r5)
1: br 1b # Done
}}
{{SubmitBox|arch=nios2}}
9b77f8851b31d87398b4f117ccaad323a66d8c4a
Arm/loaddecl2
0
214
561
2017-11-05T22:51:54Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="gas">ldr r0, =Data ldr r1, [r0] add r0, r0, r1 ldr r1, [r0] add r0, r0, r1 ldr r2, [r0] </syntaxhighlight> D..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">ldr r0, =Data
ldr r1, [r0]
add r0, r0, r1
ldr r1, [r0]
add r0, r0, r1
ldr r2, [r0]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r2 = 0x1234</li></ul>
{{ExampleBox|[None]|2=r2=0x1234 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r0, =Data
ldr r1, [r0]
add r0, r0, r1
ldr r1, [r0]
add r0, r0, r1
ldr r2, [r0]
1: b 1b // Done
}}
{{SubmitBox|arch=arm}}
3574aac9acf98bccce3690fd41fda287b44be048
Arm/loaddecl3
0
215
562
2017-11-05T23:08:15Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="gas">ldr r0, =Data ldr r1, [r0] ldr r2, [r1] ldr r3, [r2] </syntaxhighlight> Declare some data in memory suc..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">ldr r0, =Data
ldr r1, [r0]
ldr r2, [r1]
ldr r3, [r2]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r3 = 0x12345</li>
<li>r0, r1, and r2 are all different</li></ul>
{{ExampleBox|[None]|2=r3=0x12345 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r0, =Data
ldr r1, [r0]
ldr r2, [r1]
ldr r3, [r2]
1: b 1b // Done
}}
{{SubmitBox|arch=arm}}
01e6285dab1d149ea9a21e6dce411a68fdc2b87e
Arm/loaddecl4
0
216
563
2017-11-05T23:19:27Z
Henry
1
Created page with "Consider the assembly code snippet below: <syntaxhighlight lang="text">ldr r2, =Data ldr r3, [r2] ldr r4, [r3, #1] ldr r5, [r4, #2] </syntaxhighlight> Declare some data in m..."
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="text">ldr r2, =Data
ldr r3, [r2]
ldr r4, [r3, #1]
ldr r5, [r4, #2]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r5 equals r2</li>
<li>r2, r3, and r4 are all different</li></ul>
{{ExampleBox|[None]|2=r2=r5 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r2, =Data
ldr r3, [r2]
ldr r4, [r3, #1]
ldr r5, [r4, #2]
1: b 1b // Done
}}
{{SubmitBox|arch=arm}}
04afa36ca87d0991630b3eabe64a7b596f45abac
Arm/arrayinsert
0
217
564
2017-11-05T23:32:46Z
Henry
1
Created page with "Write a function that inserts a new element into an array of 32-bit integers. The elements after the insertion position should be moved by one position (expanding the array by..."
wikitext
text/x-wiki
Write a function that inserts a new element into an array of 32-bit integers. The elements after the insertion position should be moved by one position (expanding the array by one).
The first argument is a pointer to the start of the array. The second argument is the number of elements in the array. The third argument indicates where to insert the new element. The fourth argument is the number to insert.
There is no return value.
<syntaxhighlight lang="c">void array_insert (int *array, unsigned int length, unsigned int insert_at, int num);</syntaxhighlight>
'''insert_at''' is guaranteed to be no greater than '''length''' (No insertion past the end of the array)
{{ExampleBox|[1 2 3 4], 2, 123 |2=[1 2 123 3 4] | 3=
.data
// Leave some space for the expanded array
Array: .word 1, 2, 3, 4, 0xff, 0xff
.text
.global _start
_start:
ldr r0, =Array
ldr r1, =4
ldr r2, =2
ldr r3, =123
bl array_insert
1: b 1b // Done
array_insert:}}
{{SubmitBox|arch=arm}}
510f424f80a46d09bfffd954c42b8cbb5b1a2f49
Nios/sum args20
0
137
565
366
2017-11-05T23:42:51Z
Henry
1
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this. (This will be particularly useful for functions with variable arguments, e.g., <vlgstat tc="nios/sum_args"/>)
<source lang="c">int sum(int n1, int n2, int n3, ... , int n20);</source>
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial sp
subi sp, sp, 64 # 16 stack parameters
movi r2, 5
movi r4, 20
mov r3, sp
initloop:
stw r2, 0(r3)
addi r3, r3, 4
addi r2, r2, 1
ble r2, r4, initloop
movia r4, 1
movia r5, 2
movia r6, 3
movia r7, 4
call sum
addi sp, sp, 64 # Clean up stack
1: br 1b # done
sum: }}
{{SubmitBox|arch=nios2}}
56fb47469bd89a61ce5037c06765261ed61e7078
Arm/sum args20
0
218
566
2017-11-05T23:49:24Z
Henry
1
Created page with "Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments. Return the sum of all 20 numbers. Over..."
wikitext
text/x-wiki
Write a function with 20 arguments that returns the sum of all of its arguments. The function will be called with exactly 20 arguments.
Return the sum of all 20 numbers. Overflowing a 32-bit register should wrap around (i.e., no special handling).
Push the four register parameters onto the stack in the function prologue, then iterate over the parameters (now stored consecutively on the stack) in a loop. We'll check your stack frame to ensure you did this. (This will be particularly useful for functions with variable arguments, e.g., <vlgstat tc="arm/sum_args"/>)
<source lang="c">int sum(int n1, int n2, int n3, ... , int n20);</source>
{{ExampleBox|sum(1, 2, 3, ... , 20)| 210 | 3=
.global _start
_start:
ldr sp, =0x04000000 // Initial sp
sub sp, sp, #64 // 16 stack parameters
mov r0, #5
mov r1, #20
mov r2, sp
initloop:
str r0, [r2], #4 // Post-indexed addressing: Add 4 to r2 after
add r0, r0, #1
cmp r0, r1
ble initloop
mov r0, #1
mov r1, #2
mov r2, #3
mov r3, #4
bl sum
add sp, sp, #64 // Clean up stack
1: b 1b // done
sum: }}
{{SubmitBox|arch=arm}}
50cb7296802b0259b7ee0aa3818b33191598ff0c
Arm/structstore
0
219
567
2017-11-06T00:01:27Z
Henry
1
Created page with "Consider the following struct: <source lang="c">struct Codes { char postal_code[7]; unsigned short area_code; };</source> Write a function that will write to a given entry..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct Codes {
char postal_code[7];
unsigned short area_code;
};</source>
Write a function that will write to a given entry of an array of struct Codes. The first two function parameters specify the beginning of the array of structs and which array element to modify (index=0 is the first array element). The third and fourth parameters provide the new value of the postal_code and area_code fields.
You are guaranteed that ''postcode'' is a null-terminated string of no more than 6 characters (not including the NULL). Ensure the ''postal_code'' is also null-terminated (but do not modify any bytes after the null).
<source lang="c">void set_data (struct Codes* array, int index, char *postcode, unsigned short areacode);</source>
{{ExampleBox|Write {"N2L3G1",519} into { {"M5S3G4",416}, {"V6T1Z4",604}, {"K7L3N6",613} } at position 1|2={ {"M5S3G4",416}, {"N2L3G1",519}, {"K7L3N6",613} }| 3=
.data
List:
.string "M5S3G4"
.align 1
.hword 416
.string "V6T1Z4"
.align 1
.hword 604
.string "K7L3N6"
.align 1
.hword 613
.align 2
PCode: .string "N2L3G1"
.text
.global _start
_start:
ldr r0, =List
mov r1, #1
ldr r2, =PCode
ldr r3, =519
bl set_data
1: b 1b // done
set_data: }}
{{SubmitBox|arch=arm}}
48253f774e8df78e223739b151be5651871dbfee
Arm/structfind
0
220
568
2017-11-06T06:27:05Z
Henry
1
Created page with "Consider the following struct: <source lang="c">struct ProfitList { unsigned int product_id; int profit; };</source> An array of this struct can be used as a list of produc..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
<source lang="c">struct ProductInfo {
unsigned int product_id;
char *product_name;
};</source>
An array of struct ProductInfo maps each product_id with its name. For this problem, it is not important whether product_name is null or actually points to a valid string.
Given an array of ProfitList, find the product with the maximum profit (profit can be negative). There will be at least one entry in this array. If there is more than one product with maximum profit, return the first one.
Then, look up the product_id in an array of ProductInfo and return the product_name for that product. If the maximum-profit product isn't in the ProductInfo list, return 0.
<source lang="c">char* find (struct ProfitList* profit_array, unsigned int profit_array_entries, struct ProductInfo* info_array, unsigned int info_array_entries);</source>
{{ExampleBox|[See sample input below]|2=r0=0x210| 3=
// Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11 // 11 is the maximum profit. Product_id=0x1001
.word 0x1002, 9
ProdInfo:
.word 0x1000, 0x200
.word 0x1001, 0x210 // Product_id 0x1001 has name 0x210. Return 0x210.
.word 0x1002, 0x220
.text
.global _start
_start:
ldr r0, =ProdList
ldr r1, =3
ldr r2, =ProdInfo
ldr r3, =3
bl find
1: b 1b // done
// Your function starts here:
find: }}
{{SubmitBox|arch=nios2}}
b1f182461ad877159c331eb4dfa549fe6b285115
573
568
2017-11-06T07:09:30Z
Henry
1
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
<source lang="c">struct ProductInfo {
unsigned int product_id;
char *product_name;
};</source>
An array of struct ProductInfo maps each product_id with its name. For this problem, it is not important whether product_name is null or actually points to a valid string.
Given an array of ProfitList, find the product with the maximum profit (profit can be negative). There will be at least one entry in this array. If there is more than one product with maximum profit, return the first one.
Then, look up the product_id in an array of ProductInfo and return the product_name for that product. If the maximum-profit product isn't in the ProductInfo list, return 0.
<source lang="c">char* find (struct ProfitList* profit_array, unsigned int profit_array_entries, struct ProductInfo* info_array, unsigned int info_array_entries);</source>
{{ExampleBox|[See sample input below]|2=r0=0x210| 3=
// Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11 // 11 is the maximum profit. Product_id=0x1001
.word 0x1002, 9
ProdInfo:
.word 0x1000, 0x200
.word 0x1001, 0x210 // Product_id 0x1001 has name 0x210. Return 0x210.
.word 0x1002, 0x220
.text
.global _start
_start:
ldr r0, =ProdList
ldr r1, =3
ldr r2, =ProdInfo
ldr r3, =3
bl find
1: b 1b // done
// Your function starts here:
find: }}
{{SubmitBox|arch=arm}}
82322ff03a37eaf8c7ecb27fa274ee0710cc3d43
Nios/structfind
0
140
569
368
2017-11-06T06:27:12Z
Henry
1
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
<source lang="c">struct ProductInfo {
unsigned int product_id;
char *product_name;
};</source>
An array of struct ProductInfo maps each product_id with its name. For this problem, it is not important whether product_name is null or actually points to a valid string.
Given an array of ProfitList, find the product with the maximum profit (profit can be negative). There will be at least one entry in this array. If there is more than one product with maximum profit, return the first one.
Then, look up the product_id in an array of ProductInfo and return the product_name for that product. If the maximum-profit product isn't in the ProductInfo list, return 0.
<source lang="c">char* find (struct ProfitList* profit_array, unsigned int profit_array_entries, struct ProductInfo* info_array, unsigned int info_array_entries);</source>
{{ExampleBox|[See sample input below]|2=r2=0x210| 3=
# Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11 # 11 is the maximum profit. Product_id=0x1001
.word 0x1002, 9
ProdInfo:
.word 0x1000, 0x200
.word 0x1001, 0x210 # Product_id 0x1001 has name 0x210. Return 0x210.
.word 0x1002, 0x220
.text
.global _start
_start:
movia r4, ProdList
movia r5, 3
movia r6, ProdInfo
movia r7, 3
call find
1: br 1b # done
# Your function starts here:
find: }}
{{SubmitBox|arch=nios2}}
c00256db5a931f1d00f62f74bf0d313713464278
Arm/structsort
0
221
570
2017-11-06T07:06:07Z
Henry
1
Created page with "Consider the following struct: <source lang="c">struct ProfitList { unsigned int product_id; int profit; };</source> An array of this struct can be used as a list of produc..."
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
Given an array of ProfitList, sort the list by profit (descending), then by product_id (ascending) if the profit is the same. In other words, the highest profit product should be moved to the beginning of the array, and if two products have the same profit, the one with smaller product id comes first.
<source lang="c">void sort (struct ProfitList* profit_array, unsigned int profit_array_entries);</source>
{{ExampleBox|[See sample input below]|[The sorted array]| 3=
// Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11
.word 0x1002, 9
.text
.global _start
_start:
ldr r0, =ProdList
ldr r1, =3
bl sort
1: b 1b // done
// Your function starts here:
sort: }}
{{SubmitBox|arch=nios2}}
3e727dc4efd9cd747a838f0d45162c93142ae57b
572
570
2017-11-06T07:09:15Z
Henry
1
wikitext
text/x-wiki
Consider the following struct:
<source lang="c">struct ProfitList {
unsigned int product_id;
int profit;
};</source>
An array of this struct can be used as a list of products (each with a product id) and the profit for selling each item.
Given an array of ProfitList, sort the list by profit (descending), then by product_id (ascending) if the profit is the same. In other words, the highest profit product should be moved to the beginning of the array, and if two products have the same profit, the one with smaller product id comes first.
<source lang="c">void sort (struct ProfitList* profit_array, unsigned int profit_array_entries);</source>
{{ExampleBox|[See sample input below]|[The sorted array]| 3=
// Some input data and testing code
.data
ProdList:
.word 0x1000, 10
.word 0x1001, 11
.word 0x1002, 9
.text
.global _start
_start:
ldr r0, =ProdList
ldr r1, =3
bl sort
1: b 1b // done
// Your function starts here:
sort: }}
{{SubmitBox|arch=arm}}
77c64d9ebe681a6920d3b6bc84706c9d4605eab1
Arm/findstack
0
222
571
2017-11-06T07:08:56Z
Henry
1
Created page with "Write a function that will return the beginning of the stack frame of the function. This is the value of <tt>sp</tt> at the beginning of the function, and would point to the f..."
wikitext
text/x-wiki
Write a function that will return the beginning of the stack frame of the function. This is the value of <tt>sp</tt> at the beginning of the function, and would point to the first function parameter passed on the stack (i.e., the 5th function parameter), if any.
{{ExampleBox|[none]|2=r0=0x04000000| 3=
// Some testing code
.global _start
_start:
ldr sp, =0x4000000
bl where
1: b 1b // done
// Your function starts here:
where: }}
{{SubmitBox|arch=arm}}
3f3e28343de2569b2c19eab5f01f20e6dbfd3aee
Arm/findlabel
0
223
574
2017-11-06T07:11:41Z
Henry
1
Created page with "Write a function that will return the location pointed to by the label <tt>Waldo</tt>. {{ExampleBox|[none]|2=r2=0x04000000| 3= // Some testing code // Make sure to submit wit..."
wikitext
text/x-wiki
Write a function that will return the location pointed to by the label <tt>Waldo</tt>.
{{ExampleBox|[none]|2=r2=0x04000000| 3=
// Some testing code
// Make sure to submit without "Waldo" defined in your code, or you will get a "multiple definition" error.
// Waldo: .string "Where's Waldo??"
.global _start
_start:
bl where
1: b 1b // done
// Your function starts here:
where: }}
{{SubmitBox|arch=arm}}
833c775e344530a1320cdc5bdbfac7d7cce3bbe8
Arm/findme
0
224
575
2017-11-06T07:14:27Z
Henry
1
Created page with "Write a function that will return the location of the first instruction of your function (i.e., where in memory your function starts). {{ExampleBox|[none]|[varies]| 3= // Som..."
wikitext
text/x-wiki
Write a function that will return the location of the first instruction of your function (i.e., where in memory your function starts).
{{ExampleBox|[none]|[varies]| 3=
// Some testing code
.global _start
_start:
bl where
1: b 1b // done
# Your function starts here:
where: }}
{{SubmitBox|arch=arm}}
e4e69cf2a7889215476677c3140ea8492f194108
Arm/findfunction
0
225
576
2017-11-06T07:17:38Z
Henry
1
Created page with "You are provided a function named <tt>MyFunc</tt>. Write a function that will return the first instruction (32-bit word) of the function <tt>MyFunc</tt>. {{ExampleBox|[none]|..."
wikitext
text/x-wiki
You are provided a function named <tt>MyFunc</tt>. Write a function that will return the first instruction (32-bit word) of the function <tt>MyFunc</tt>.
{{ExampleBox|[none]|2=r0=0x04000000| 3=
// Some testing code
// Make sure to submit without "MyFunc" defined in your code, or you will get a "multiple definition" error.
// MyFunc: ret
.global _start
_start:
bl get_opcode
1: b 1b // done
// Your function starts here:
get_opcode: }}
{{SubmitBox|arch=arm}}
8b3b762b7452098e9e4ddcaebc63cea924edc249
Arm/findcaller
0
226
577
2017-11-06T07:19:56Z
Henry
1
Created page with "Write a function that will return the location of the call instruction that called your function. {{ExampleBox|[none]|[varies]| 3= // Some testing code .global _start _start:..."
wikitext
text/x-wiki
Write a function that will return the location of the call instruction that called your function.
{{ExampleBox|[none]|[varies]| 3=
// Some testing code
.global _start
_start:
bl where
1: b 1b // done
// Your function starts here:
where: }}
{{SubmitBox|arch=arm}}
4203148d2bf9f059f650e16d976674b5bf87a4e6
Nios/loadexec
0
148
578
381
2017-11-06T07:35:27Z
Henry
1
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( int(*dest)(int), int(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length'' bytes. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param'', and returning its return value (i.e., with ''dest'' as a function pointer, do <tt>return dest(param)</tt>)
{{ExampleBox|[See below]|2=r2=8| 3=
# Some testing code
# When debugging in CPUlator, turn off the following debugging checks:
# - Instruction fetch: Modified opcode
# - Instruction fetch: Outside a code section (If Dest is outside the .text section)
Src:
add r2, r4, r4 # This function returns double its parameter.
ret
Dest:
.skip 8 # Make space for the code
.global _start
_start:
movia r4, Dest
movia r5, Src
movia r6, 8 # There are 2 instructions to copy: 8 bytes
movia r7, 4 # Let's call the function with parameter 4
call loadexec
1: br 1b # done
# Your function starts here:
loadexec: }}
{{SubmitBox|arch=nios2}}
93c2cb29e7445c48510363fcd7ed53e5c6c9ff30
Arm/loadexec
0
227
579
2017-11-06T22:23:51Z
Henry
1
Created page with "Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter. <source la..."
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( int(*dest)(int), int(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length'' bytes. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param'', and returning its return value (i.e., with ''dest'' as a function pointer, do <tt>return dest(param)</tt>)
{{ExampleBox|[See below]|2=r0=8| 3=
// Some testing code
// When debugging in CPUlator, turn off the following debugging checks:
// - Instruction fetch: Modified opcode
// - Instruction fetch: Outside a code section (If Dest is outside the .text section)
Src:
add r0, r0, r0 // This function returns double its parameter.
mov pc, lr
Dest:
.skip 8 // Make space for the code
.global _start
_start:
ldr r0, =Dest
ldr r1, =Src
ldr r2, =8 // There are 2 instructions to copy: 8 bytes
ldr r3, =4 // Let's call the function with parameter 4
bl loadexec
1: b 1b // done
// Your function starts here:
loadexec: }}
{{HintBox|Due to the stringent debug checks used by this simulator, don't use <tt>pop {pc}</tt> unless the intention is to return from a function.}}
{{SubmitBox|arch=arm}}
05f39f5b9816e9fc2994869d33109bd4e8eff2ac
Arm/7seg
0
228
580
2017-11-06T23:31:52Z
Henry
1
Created page with "Write a function that will compute a 7-bit value suitable for displaying one hexadecimal digit (0 to f) on a seven-segment display. Each of the display's segments maps to one..."
wikitext
text/x-wiki
Write a function that will compute a 7-bit value suitable for displaying one hexadecimal digit (0 to f) on a seven-segment display. Each of the display's segments maps to one bit of the number, as indicated in the diagram below (1=on, 0=off). Because the display has 7 segments, only the lowest 7 bits are used. Set the upper bits to zero.
Your function will be passed one parameter: The number to be displayed (guaranteed to be 0 to 15). Return the appropriate bit pattern.
[[File:7seg.png]]
{{ExampleBox|1=r0=8|2=r0=0x7f| 3=
// Some testing code
.global _start
_start:
ldr r0, =8
bl sevenseg
1: b 1b // done
// Your function starts here:
sevenseg: }}
{{SubmitBox|arch=arm}}
ee6e30b4f82c584bc35c4ec9b4a6383234484af0
Nios/7seg8
0
151
581
385
2017-11-06T23:37:57Z
Henry
1
wikitext
text/x-wiki
Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated into two groups of four, with each group of four being controlled by a 32-bit bit pattern (as four groups of 8 bits, with the highest bit of each byte unused).
<ul><li>bit[6:0]: right-most digit</li>
<li>bit[14:8]</li>
<li>bit[22:16]</li>
<li>bit[30:24]: left-most digit</li></ul>
<source lang="c">unsigned long long hexdisplay(unsigned int number);</source>
Your function will be passed one parameter: The number to be displayed. It should return the 64-bit bit pattern in r2 (least-significant 32 bits) and r3 (most-significant 32 bits).
Use the following bit patterns for digits. You may wish to reuse <vlgstat tc="nios/7seg"/>.
[[File:7seg.png]]
{{ExampleBox|1=r4=8|2=r3=0x3f3f3f3f, r2=0x3f3f3f7f| 3=
# Some testing code
.global _start
_start:
movi r4, 8
call hexdisplay
1: br 1b # done
# Your function starts here:
hexdisplay: }}
{{SubmitBox|arch=nios2}}
0c5737d8b4ca0c889cf707fdb296bcc4040d9f24
Arm/7seg8
0
229
582
2017-11-06T23:40:08Z
Henry
1
Created page with "Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated..."
wikitext
text/x-wiki
Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated into two groups of four, with each group of four being controlled by a 32-bit bit pattern (as four groups of 8 bits, with the highest bit of each byte unused).
<ul><li>bit[6:0]: right-most digit</li>
<li>bit[14:8]</li>
<li>bit[22:16]</li>
<li>bit[30:24]: left-most digit</li></ul>
<source lang="c">unsigned long long hexdisplay(unsigned int number);</source>
Your function will be passed one parameter: The number to be displayed. It should return the 64-bit bit pattern in r2 (least-significant 32 bits) and r3 (most-significant 32 bits).
Use the following bit patterns for digits. You may wish to reuse <vlgstat tc="arm/7seg"/>.
[[File:7seg.png]]
{{ExampleBox|1=r0=8|2=r1=0x3f3f3f3f, r0=0x3f3f3f7f| 3=
// Some testing code
.global _start
_start:
ldr r0, =8
bl hexdisplay
1: b 1b // done
// Your function starts here:
hexdisplay: }}
{{SubmitBox|arch=arm}}
a25ac8d394d767001c8ed14298305b75a88fabd0
Arm/accum1
0
230
583
2017-11-06T23:45:03Z
Henry
1
Created page with "Write a function that performs a sequence of calculations (addition, subtraction, multiplication), following instructions encoded in an array of bytes. This calculator is ba..."
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication), following instructions encoded in an array of bytes.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>null: Return from the function and return the current Accumulator value in r2.</li></ol>
For example, the (null-terminated) string "+0+@-P" encodes 4 operations:
<ol><li>"+0": Add 0x30 to the accumulator. The accumulator starts off as 0, and now contains 0x30</li>
<li>"+@": Add 0x40 to the accumulator. The accumulator now contains 0x70</li>
<li>"-P": Subtract 0x50 from the accumulator. The accumulator now contains 0x20</li>
<li>null: Quit. The function returns 0x20 in r2</li>
</ol>
Similarly, the following will compute 100*100:
<source lang="gas">.byte '+', 100, '*', 100, 0</source>
Starting with an accumulator with 0, add 100, then multiply by 100, then return the result.
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|"+0+@-P"|2=r0=0x20| 3=
// Some testing code
.data
Cmd: .string "+0+@-P"
.text
.global _start
_start:
ldr r0, =Cmd
bl calc
1: b 1b // done
// Your function starts here:
calc: }}
{{SubmitBox|arch=arm}}
e67fef8536edc0e9266dc3079a914626e5814ae9
Arm/accum2
0
231
584
2017-11-06T23:50:06Z
Henry
1
Created page with "Write a function that performs a sequence of calculations (addition, subtraction, multiplication, conditional branch), following instructions encoded in an array of bytes. Thi..."
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication, conditional branch), following instructions encoded in an array of bytes. This is an extension of <vlgstat tc="Nios/accum1"/>, by adding two conditional branch instructions.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', 'b', 'B', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>'b': '''If Accumulator < 0''', then skip over ''operand'' instructions and keep going. ''operand'' = 0 means continue with the following instruction, while ''operand'' = -1 means go backwards one instruction (equivalent to repeating the 'b' instruction forever.). '''If accumulator >= 0''', then do nothing and continue reading the next instruction.</li>
<li>'B': This is exactly the same as 'b', but with the condition reversed. Branch if accumulator >= 0.</li>
<li>null: Return from the function and return the current Accumulator value in r2.</li></ol>
For example the following will compute 1+3:
<source lang="gas">.byte '+', 1, 'B', 1, '+', 2, '+', 3, 0</source>
Starting with an accumulator with 0, add 1, then skip over 1 instruction because the accumulator is non-negative, then add 3. (The "add 2" is skipped over because the branch-if-non-negative occurred with an accumulator of 1)
But the following will compute 1+2+3, because the branch-if-negative is not taken:
<source lang="gas">.byte '+', 1, 'b', 1, '+', 2, '+', 3, 0</source>
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|+ 1, B 1, + 2, + 3|2=r0=0x4| 3=
// Some testing code
.data
Cmd: .byte '+', 1, 'B', 1, '+', 2, '+', 3, 0
Cmd2: .byte '+', 1, 'b', 1, '+', 2, '+', 3, 0
.text
.global _start
_start:
ldr r0, =Cmd
bl calc
1: b 1b // done
// Your function starts here:
calc: }}
{{SubmitBox|arch=arm}}
45bccb94e8212812037239cd1f22a477d7f9f816
Arm/ifelse1
0
232
585
2017-11-07T03:03:09Z
Henry
1
Created page with "Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even. <syntaxhighlight lang..."
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
You are provided the functions <tt>odd</tt> and <tt>even</tt>. To make the problem easier, these two functions do not clobber any registers.
{{ExampleBox|1|[no output, odd() is called]|3=
// Some testing code
// You may uncomment these during testing, but comment them out before submitting
// odd: ret
// even: ret
.global _start
_start:
ldr r0, =1 // First function parameter is always passed through r4.
bl oddeven
1: b 1b // Done
oddeven:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return. (This can be shorted to pop {pc} )
pop {lr}
bx lr
}}
{{SubmitBox|arch=arm}}
f11c66e0da9f6fd9b9f1087d81a4eb5ef7c02619
586
585
2017-11-07T03:12:32Z
Henry
1
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
You are provided the functions <tt>odd</tt> and <tt>even</tt>. To make the problem easier, these two functions do not clobber any registers.
{{ExampleBox|1|[no output, odd() is called]|3=
// Some testing code
// You may uncomment these during testing, but comment them out before submitting
// odd: bx lr
// even: bx lr
.global _start
_start:
ldr r0, =1 // First function parameter is always passed through r4.
bl oddeven
1: b 1b // Done
oddeven:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return. (This can be shorted to pop {pc} )
pop {lr}
bx lr
}}
{{SubmitBox|arch=arm}}
596923a72464c15d35aa3dfb90aec8d1faef52c9
Arm/ifelse2
0
233
587
2017-11-07T03:31:16Z
Henry
1
Created page with "You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples,..."
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r0=5|2=add_a and done are called|3=
// Some testing code
// You may uncomment these during testing
// add_a: bx lr
// add_b: bx lr
// add_c: bx lr
// add_d: bx lr
// add_e: bx lr
// done: bx lr
.global _start
_start:
ldr r0, =5 // First function parameter is always passed through r4.
bl build
1: b 1b // Done
build:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return.
pop {pc}
}}
{{SubmitBox|arch=nios2}}
693bcc1ae3372ac788d805c16df88c2886195c62
Arm/random
0
234
588
2017-11-07T03:40:28Z
Henry
1
Created page with "A ''linear congruential generator'' is a simple method often used to generate pseudorandom number sequences. The sequence starts with an arbitrary number (called a "seed"). Th..."
wikitext
text/x-wiki
A ''linear congruential generator'' is a simple method often used to generate pseudorandom number sequences. The sequence starts with an arbitrary number (called a "seed"). Then to generate the next number in the sequence, multiply by a constant ("multiplier"), then add another constant ("increment").
In this problem, we will use a seed of 0, a multiplier of 134775813, and an increment of 1. Thus, the first few numbers in the sequence are:
<ul><li>0<sup>th</sup>: 0 (This is the seed. We'll call it the 0<sup>th</sup> number)</li>
<li>1<sup>st</sup>: 1 (<b>0</b> × 134775813 + 1)</li>
<li>2<sup>nd</sup>: 134775814 (<b>1</b> × 134775813 + 1)</li></ul>
When the number overflows, keep the lowest 32 bits (i.e., mod 2<sup>32</sup>). This happens automatically without extra code.
Write a function that returns the ''n<sup>th</sup>'' number in the above sequence.
<syntaxhighlight lang="c">unsigned random (unsigned n);</syntaxhighlight>
{{ExampleBox|1=r0=2
|2=r0=134775814|3=
.global _start
_start:
ldr r0, =2 // First function parameter is always passed through r0.
bl random
1: b 1b // Done
random:}}
{{SubmitBox|arch=arm}}
6549afae0da80a49e65413e4e5972e3cc50317c8
Arm/manhattan
0
235
589
2017-11-07T03:51:14Z
Henry
1
Created page with "You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map that indicates the locations of subway stations...."
wikitext
text/x-wiki
You are in a city with a grid-like design (like Manhattan) and need to get to the nearest subway station. You are given a map that indicates the locations of subway stations. You are currently at the center of the map. Find the distance to the closest subway station, measured using [https://en.wiktionary.org/wiki/Manhatan_distance manhattan distance] (sum of horizontal and vertical distances, because you need to walk along the grid).
The map is an array of bytes, of ''width'' columns (numbered 0 to ''width''-1) and ''height'' rows (numbered 0 to ''height''-1). Bytes are arranged in row-major order (i.e., element (x,y) is located at offset <tt>x + y × width</tt>). Each byte is non-zero if there is a subway station at that location, or zero if there is not. You are at column W/2 and row H/2 (the center of the map). The map will be at least 1×1 in size and at most 10<sup>7</sup> cells in size.
Example: In the following 5×1 map, the nearest subway station is 1 unit away (to the right). You are at x=2 and y=0 (5/2 = 2, and 1/2 = 0). (There is another subway station 2 units to the left, but it isn't the closest one),
1 0 <b>0</b> 1 0
Return the manhattan distance to the nearest subway station. If there are no subway stations, return -1.
<syntaxhighlight lang="c">int manhattan (int width, int height, char* map);</syntaxhighlight>
{{ExampleBox|1=1 0 0 1 0 (width=5, height=1)|
2=1|3=
.data
Map: .byte 1, 0, 0, 1, 0
.text
.global _start
_start:
ldr r0, =5 // width
ldr r1, =1 // height
ldr r2, =Map // Pointer to 2D char array
bl manhattan
1: b 1b // Done
manhattan:}}
{{SubmitBox|arch=arm}}
04fc683ca306edd184e4d9f08c6edd2fac971916
Nios/square
0
159
590
419
2017-11-07T03:55:56Z
Henry
1
wikitext
text/x-wiki
Write a function that will draw a white square onto a 640×480, 16 bit per pixel image.
The image is an array of 640 pixels per row (left to right) and 480 rows (top to bottom), where each pixel is 16 bits (2 bytes) (Thus, there are 1280 bytes per row). The top-left corner of the image is pixel (0, 0), while the bottom right is pixel (639, 479). A white pixel has the 16-bit value 0xffff.
Draw a white square of the given size (width and height), with the upper-left corner of the square located at the given left and top pixels. The square will have size at least 1 pixel, and the entire square will fit in the image (you do not need to check for the square exceeding the image boundaries).
<syntaxhighlight lang="c">void square (void* image, int left, int top, int size);</syntaxhighlight>
{{ExampleBox|1=square(Img, 1, 0, 3)|
2=See below|3=
.data
Img: .skip 640*480*2
.text
.global _start
_start:
movia r4, Img # Image
movi r5, 1 # top
movi r6, 0 # left
movi r7, 3 # size
call square
1: br 1b # Done
square:}}
{{SubmitBox|arch=nios2}}
4b1d831a9aac6f94f45a5a61b199460da9ad0ec6
Arm/square
0
236
591
2017-11-07T03:56:36Z
Henry
1
Created page with "Write a function that will draw a white square onto a 640×480, 16 bit per pixel image. The image is an array of 640 pixels per row (left to right) and 480 rows (top to..."
wikitext
text/x-wiki
Write a function that will draw a white square onto a 640×480, 16 bit per pixel image.
The image is an array of 640 pixels per row (left to right) and 480 rows (top to bottom), where each pixel is 16 bits (2 bytes) (Thus, there are 1280 bytes per row). The top-left corner of the image is pixel (0, 0), while the bottom right is pixel (639, 479). A white pixel has the 16-bit value 0xffff.
Draw a white square of the given size (width and height), with the upper-left corner of the square located at the given left and top pixels. The square will have size at least 1 pixel, and the entire square will fit in the image (you do not need to check for the square exceeding the image boundaries).
<syntaxhighlight lang="c">void square (void* image, int left, int top, int size);</syntaxhighlight>
{{ExampleBox|1=square(Img, 1, 0, 3)|
2=See below|3=
.data
Img: .skip 640*480*2
.text
.global _start
_start:
ldr r0, =Img // Image
ldr r1, =1 // top
ldr r2, =0 // left
ldr r3, =3 // size
bl square
1: b 1b // Done
square:}}
{{SubmitBox|arch=arm}}
1b8707e613397bbe0cba0299bc38e78453a1a982
Arm/uartread
0
237
592
2017-11-07T04:13:17Z
Henry
1
Created page with "Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to rea..."
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit [15]: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r0 (the return value) (and <tt>lr</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r0=11
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
//read_uart: # This may be useful for debugging
ldr r0, =0xff201000
ldwio r0, [r0]
bx lr
.global _start
_start:
ldr sp, =0x04000000 // Initialize SP for debugging.
ldr r0, =Out // Use Out as the output string
bl uartgets
1: b 1b // Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=arm|simsystem=arm}}
cf4c2e85c82eb9331fb7da2c96f0de067b58c746
593
592
2017-11-07T04:13:36Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit [15]: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r0 (the return value) (and <tt>lr</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r0=11
|3=
.data
Out: .skip 256 // Reserve some space for output
.text
//read_uart: // This may be useful for debugging
ldr r0, =0xff201000
ldwio r0, [r0]
bx lr
.global _start
_start:
ldr sp, =0x04000000 // Initialize SP for debugging.
ldr r0, =Out // Use Out as the output string
bl uartgets
1: b 1b // Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=arm|simsystem=arm}}
8a4f95255663972d6fb74ed205161f796545ec99
594
593
2017-11-07T04:14:04Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit [15]: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r0 (the return value) (and <tt>lr</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r0=11
|3=
.data
Out: .skip 256 // Reserve some space for output
.text
//read_uart: // This may be useful for debugging
ldr r0, =0xff201000
ldr r0, [r0]
bx lr
.global _start
_start:
ldr sp, =0x04000000 // Initialize SP for debugging.
ldr r0, =Out // Use Out as the output string
bl uartgets
1: b 1b // Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=arm|simsystem=arm}}
44ec1cf5388671e71a78abaf1fabf200e9eecc9a
Arm/cacheblock
0
238
595
2017-11-07T04:18:53Z
Henry
1
Created page with "Consider the following cache: <ul><li>12 KB (12,288 bytes)</li> <li>3-way set-associative</li> <li>256 sets</li></ul> Write a function that will determine whether two address..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>12 KB (12,288 bytes)</li>
<li>3-way set-associative</li>
<li>256 sets</li></ul>
Write a function that will determine whether two addresses fall within the same cache block in this cache. Your function must return 1 or 0.
{{ExampleBox|1=cacheblock(0, 2) | 2=r0=1
|3=
.global _start
_start:
ldr r0, =0
ldr r1, =2
bl cacheblock
1: b 1b // Done
cacheblock:}}
{{SubmitBox|arch=arm}}
b2af99f4e414c2642fe0c74402886896af8c9ebf
Arm/cacheset
0
239
596
2017-11-07T04:21:22Z
Henry
1
Created page with "Consider the following cache: <ul><li>12 KB (12,288 bytes)</li> <li>3-way set-associative</li> <li>256 sets</li></ul> Write a function that will determine whether two address..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>12 KB (12,288 bytes)</li>
<li>3-way set-associative</li>
<li>256 sets</li></ul>
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function must return 1 or 0.
{{ExampleBox|1=cacheblock(0, 2) | 2=r0=1
|3=
.global _start
_start:
ldr r0, =0
ldr r1, =2
bl cacheset
1: b 1b // Done
cacheset:}}
{{SubmitBox|arch=arm}}
c12f62e9cb4c1c0030eb2c9f1ba3ce193685467e
Arm/cacheset2
0
240
597
2017-11-07T04:36:49Z
Henry
1
Created page with "Consider the following cache: <ul><li>2<sup>S</sup> sets</li> <li>2<sup>B</sup> block size</li></ul> Write a function that will determine whether two addresses will map to th..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether the two addresses map to the same cache set. S and B will be valid values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r0=1
|3=
.global _start
_start:
ldr r0, =8
ldr r1, =4
ldr r2, =0
ldr r3, =2
bl cacheset
1: b 1b // Done
cacheset:}}
{{SubmitBox|arch=arm}}
e26a8a914cabe301bc542743d621a1359e75bc59
Arm/cacheset3
0
241
598
2017-11-07T04:57:39Z
Henry
1
Created page with "Consider the following cache: <ul><li>2<sup>S</sup> sets</li> <li>2<sup>B</sup> block size</li></ul> Write a function that will determine whether an access to one addresses c..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>2<sup>S</sup> sets</li>
<li>2<sup>B</sup> block size</li></ul>
Write a function that will determine whether an access to one addresses can cause the cache line containing the other address to be evicted from the cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether one address can cause the eviction of the other. S and B will be valid values for a 32-bit address.
<source lang="c">int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2) | 2=r0=0
|3=
.global _start
_start:
ldr r0, =8
ldr r1, =4
ldr r2, =0
ldr r3, =2
bl cacheset
1: b 1b // Done
cacheset:}}
{{SubmitBox|arch=arm}}
bc0257a264bf70e02fce3ec775c3804b14da28ba
Arm/cachetag
0
242
599
2017-11-07T05:39:01Z
Henry
1
Created page with "Consider the following cache: <ul><li>Capacity of C bytes</li> <li>Associativity of 2<sup>W</sup> ways</li></ul> Write a function that will determine whether the cache blocks..."
wikitext
text/x-wiki
Consider the following cache:
<ul><li>Capacity of C bytes</li>
<li>Associativity of 2<sup>W</sup> ways</li></ul>
Write a function that will determine whether the cache blocks holding two addresses will have the same tag, for the above cache. Your function will be provided C, W, and two addresses. It must return 1 or 0 to indicate whether the cache blocks holding the two addresses would have the same tag field. C and W will be valid values for a 32-bit address, and will correspond to a cache where the block size and number of sets are powers of two.
<source lang="c">int cachetag(unsigned int C, unsigned int W, unsigned int addr1, unsigned int addr2);</source>
{{ExampleBox|1=cachetag(16384, 2, 0, 2) (16 KB, 4-way) | 2=r0=1
|3=
.global _start
_start:
ldr r0, =16384
ldr r1, =2
ldr r2, =0
ldr r3, =2
bl cachetag
1: b 1b // Done
cachetag:}}
{{SubmitBox|arch=arm}}
ae4a3b82fa577cbfa4772f0b0bc818cd7894b2fe
Arm/cachehit
0
243
600
2017-11-07T05:58:45Z
Henry
1
Created page with "Consider the following cache: <ul> <li>Direct-mapped (i.e., 1-way set-associative)</li> <li>2<sup>B</sup> block size</li> <li>2<sup>S</sup> sets</li></ul> Write a function tha..."
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Write a function that will determine whether the cache block for a given address is in a cache (i.e., will hit).
Your function will be provided B, S, an array of tags (one for each cache block), and one address.
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
Your function should return 1 or 0, indicating whether the cache block containing the given address is located in the cache.
<source lang="c">int cachehit(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int addr);</source>
{{ExampleBox|1=[See below]| 2=r0=1
|3=
.data
# This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
# for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
.text
.global _start
_start:
ldr r0, =4 // Cache has 2^4 byte blocks
ldr r1, =2 // Cache has 2^2 sets
ldr r2, =CacheTags
ldr r3, =0x110 // Is 0x110 in the cache?
bl cachehit
1: b 1b // Done
cachehit:}}
{{SubmitBox|arch=arm}}
9284724f8429ef63f894d7cd5ae6ef99aa6204bf
Arm/cachehits
0
244
601
2017-11-07T06:31:16Z
Henry
1
Created page with "Consider the following cache: <ul> <li>Direct-mapped (i.e., 1-way set-associative)</li> <li>2<sup>B</sup> block size</li> <li>2<sup>S</sup> sets</li></ul> Your function will..."
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine how many of those addresses would hit in the above cache. This problem counts the number of hits assuming the cache state does not change (i.e., it's the same problem as <vlgstat tc="nios/cachehit"/>, but run multiple times on a list of addresses. You may wish to reuse your solution from that problem).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined).
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of addresses in the address list that would hit in the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r0=1
|3=
.data
// This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
// for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x110 // This is hit (set 1)
.word 0x120 // This is a miss (set 2)
.word -1
.text
.global _start
_start:
ldr sp, =0x4000000 // This problem will probably use the stack
ldr r0, =4 // Cache has 2^4 byte blocks
ldr r1, =2 // Cache has 2^2 sets
ldr r2, =CacheTags
ldr r3, =AddressList
bl cachehits
cachehits:}}
{{SubmitBox|arch=arm}}
b18a5a9467bd20ad1a7e8cb1ab985822f83ff6da
Arm/cachehits2
0
245
602
2017-11-07T06:39:46Z
Henry
1
Created page with "Consider the following cache: <ul> <li>Direct-mapped (i.e., 1-way set-associative)</li> <li>2<sup>B</sup> block size</li> <li>2<sup>S</sup> sets</li></ul> Your function will..."
wikitext
text/x-wiki
Consider the following cache:
<ul>
<li>Direct-mapped (i.e., 1-way set-associative)</li>
<li>2<sup>B</sup> block size</li>
<li>2<sup>S</sup> sets</li></ul>
Your function will be provided B, S, an array of tags (one for each cache block), and a list of addresses. Write a function that will determine the number of cache hits if the sequence of accesses were performed on the cache with the given initial state. After each access, update the cache state (you may modify the tag array).
Assume every cache block in the cache is valid. The array of tags contains exactly 2<sup>S</sup> words, one for each set. Each entry in the array is a 32-bit word, but only the tag bits are valid (the lower bits that correspond to the set number and offset are undefined). You may modify this array as the cache state is updated.
The address list contains an array of 32-bit addresses, and is terminated with -1. Do not process the -1 as if it were an address.
Your function should return the number of cache hits if the list of cache accesses were performed on the cache.
<source lang="c">int cachehits(unsigned int B, unsigned int S, unsigned int *cachetags, unsigned int *addrlist);</source>
{{ExampleBox|1=[See below]| 2=r0=2
|3=
.data
// This direct-mapped cache has 4 sets/blocks. Their tags are 0, 0x100, 0xc0, and 0x40
// for set 0, 1, 2, and 3, respectively.
CacheTags:
.word 0
.word 0x100
.word 0xc0
.word 0x40
AddressList:
.word 0x120 // This is a miss (set 2)
.word 0x120 // This is a hit (set 2)
.word 0x122 // This is also hit to the same block (set 2)
.word 0x220 // This is a miss (set 2)
.word -1
.text
.global _start
_start:
ldr sp, =0x4000000 // This problem will probably use the stack
ldr r0, =4 // Cache has 2^4 byte blocks
ldr r1, =2 // Cache has 2^2 sets
ldr r2, =CacheTags
ldr r3, =AddressList
bl cachehits
1: b 1b // Done
cachehits:}}
{{SubmitBox|arch=arm}}
07f7c47d72d69b89aea7404967005f00d3212c57
Arm/memaddr
0
246
603
2017-11-07T06:49:27Z
Henry
1
Created page with "Consider a memory array of depth D and width of B bits. How many address lines are needed for this memory array? Write a function that returns the number of address bits for..."
wikitext
text/x-wiki
Consider a memory array of depth D and width of B bits. How many address lines are needed for this memory array?
Write a function that returns the number of address bits for a memory of depth D and width B bits. D and B will be at least 1.
<source lang="c">unsigned int addrlines(unsigned int D, unsigned int B);</source>
{{ExampleBox|1=addrlines(16, 8)| 2=r0=4
|3=
.global _start
_start:
ldr r0, =16 // Depth 16
ldr r1, =8 // 8 bit wide (128 bits of capacity)
bl addrlines
1: b 1b // Done
addrlines:}}
{{SubmitBox|arch=arm}}
e11b7f4661dab8c68d589ad9545e772aef96e163
Arm/memsize
0
247
604
2017-11-07T06:50:45Z
Henry
1
Created page with "Consider a memory array of with A address lines and D data lines. What is the capacity of this memory (in bits)? Write a function that returns the memory capacity (in bits)...."
wikitext
text/x-wiki
Consider a memory array of with A address lines and D data lines. What is the capacity of this memory (in bits)?
Write a function that returns the memory capacity (in bits). The capacity will not overflow a 32-bit unsigned integer.
<source lang="c">unsigned int memsize(unsigned int A, unsigned int D);</source>
{{ExampleBox|1=memsize(12, 8)| 2=r0=32768
|3=
.global _start
_start:
ldr r0, =12 // 12 address lines
ldr r1, =8 // 8 data lines
bl memsize
1: b 1b // Done
memsize:}}
{{SubmitBox|arch=arm}}
85a64915f7b349c3c03e31b86f234860020e4b2d
Arm/pow2
0
248
605
2017-11-07T06:58:11Z
Henry
1
Created page with "Write a function that will return whether its parameter is a power of 2. The parameter is an unsigned integer and will not be 0. <source lang="c">int pow2(unsigned int num);<..."
wikitext
text/x-wiki
Write a function that will return whether its parameter is a power of 2. The parameter is an unsigned integer and will not be 0.
<source lang="c">int pow2(unsigned int num);</source>
{{ExampleBox|1=pow2(4)| 2=r0=1
|3=
.global _start
_start:
ldr r0, =4
bl pow2
1: b 1b // Done
pow2:}}
{{SubmitBox|arch=arm}}
5c4b9a4211f0bfd899130febcb1f421658f5d4a6
Arm/mask
0
249
606
2017-11-07T07:02:06Z
Henry
1
Created page with "A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where the lowest N bits are 1 and the upper 32-N b..."
wikitext
text/x-wiki
A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where the lowest N bits are 1 and the upper 32-N bits are 0.
N will be between 0 and 32.
<source lang="c">unsigned int mask(unsigned int N);</source>
{{ExampleBox|1=mask(4)| 2=r0=0xf
|3=
.global _start
_start:
ldr r0, =4
bl mask
1: b 1b // Done
mask:}}
{{SubmitBox|arch=arm}}
a4ca131e42b7c2ff64a049f16fb1874296beee84
Arm/mask2
0
250
607
2017-11-07T07:09:11Z
Henry
1
Created page with "A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where bits M (inclusive) to N (exclusive) are 1 (b..."
wikitext
text/x-wiki
A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where bits M (inclusive) to N (exclusive) are 1 (bits are numbered from 0 to 31).
N and M are between 0 and 32. N is guaranteed to be no smaller than M. If N == M, then no bits are set to 1. The special case where M == 0 is equivalent to the previous problem (<vlgstat tc="arm/mask">mask</vlgstat>)
<source lang="c">unsigned int mask(unsigned int N, unsigned int M);</source>
{{ExampleBox|1=mask(4, 2)| 2=r0=0xc
|3=
.global _start
_start:
ldr r0, =4
ldr r1, =2
bl mask
1: b 1b // Done
mask:}}
{{SubmitBox|arch=arm}}
adf1a8c120babf95133472148ff7cb3a0ba6eb8c
Arm/memenable
0
251
608
2017-11-07T07:41:51Z
Henry
1
Created page with "You have a 4-KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. The memory should be enabled only when an address within that range i..."
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. The memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You should not use any add, sub, mul, or greater/less-than comparisons or conditional branches (equal or not-equal comparisons and branches are allowed).
<source lang="c">unsigned int memenable(unsigned int address);</source>
<small>In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost. Equality comparisons with a constant can be implemented as an AND gate with some inverted inputs, but less/greater comparisons need to do subtraction, which is much more costly.</small>
{{ExampleBox|1=memenable(0xff3100)| 2=r0=1
|3=
.global _start
_start:
ldr r0, =0xff3100
bl memenable
1: b 1b // Done
memenable:}}
{{SubmitBox|arch=arm}}
1681da5afc9cfa767e240bddd449d27f15c918ce
609
608
2017-11-07T07:43:39Z
Henry
1
wikitext
text/x-wiki
You have a 4-KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. The memory should be enabled only when an address within that range is accessed.
Write a function that returns whether a given address should cause your memory to be enabled (return 1 or 0). You should not use any add, sub, mul, or greater/less-than conditional instructions (equal or not-equal comparisons are allowed).
<source lang="c">unsigned int memenable(unsigned int address);</source>
<small>In hardware, you would typically use and/or/not gates and avoid add/sub circuits due to cost. Equality comparisons with a constant can be implemented as an AND gate with some inverted inputs, but less/greater comparisons need to do subtraction, which is much more costly.</small>
{{ExampleBox|1=memenable(0xff3100)| 2=r0=1
|3=
.global _start
_start:
ldr r0, =0xff3100
bl memenable
1: b 1b // Done
memenable:}}
{{SubmitBox|arch=arm}}
8ffa2a028fa9cc34004d020c551cc07ecf079a51
Arm/memenable2
0
252
610
2017-11-07T07:49:06Z
Henry
1
Created page with "You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of 16 256-byte de..."
wikitext
text/x-wiki
You have a 4 KB (kilobyte) memory that is mapped to the address range <tt>0xff3000 – 0xff3fff</tt>. In reality, this 4 KB memory is built out of 16 256-byte devices. When a memory access to the 4 KB range occurs, only one of the 256-byte devices should be enabled.
Write a function that returns which device should be enabled when an access to the given address occurs. If the access is outside the 4 KB range, return -1. You should not use any add, sub, mul, or greater/less-than conditional instructions (equal or not-equal comparisons are allowed).
<ul><li><tt>0xfff3000 – 0xfff30ff</tt>: Return 0</li>
<li><tt>0xfff3100 – 0xfff31ff</tt>: Return 1</li>
<li><tt>0xfff3200 – 0xfff32ff</tt>: Return 2</li>
<li>...etc</li>
<li><tt>0xfff3f00 – 0xfff3fff</tt>: Return 15</li>
<li>Outside <tt>0xfff3000 – 0xfff3fff</tt>: Return -1</li></ul>
<source lang="c">unsigned int memenable(unsigned int address);</source>
{{ExampleBox|1=memenable(0xff3100)| 2=r0=1
|3=
.global _start
_start:
ldr r0, =0xff3100
bl memenable
1: b 1b // Done
memenable:}}
{{SubmitBox|arch=arm}}
9614e9fa0ab2fa3b7622909e8e97b7178e8b1f5b
Arm/callparam
0
55
611
297
2017-11-07T07:52:15Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. Also don't forget to save <tt>lr</tt>, as the function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
_start:
bl call1234
1: b 1b
//secret: // For debugging, uncomment this label
// Don't submit with this label though, or you will get a duplicate label error.
mov r0, #1
bx lr
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than branch-and-link) to call the function. Because you didn't use branch-and-link, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call optimization in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=arm}}
aef65f62e259f4602c46a885d33e0a4de5a7ca0a
634
611
2017-11-27T19:04:21Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return the result of <tt>secret(1,2,3,4)</tt>. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 () {
return secret(1,2,3,4);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r3</tt>. Also don't forget to save <tt>lr</tt>, as the function call will clobber it. (See Hint for an alternative method).
{{ExampleBox|1=No input|2=1|3=
.global _start
_start:
bl call1234
1: b 1b
//secret: // For debugging, uncomment this label
// Don't submit with this label though, or you will get a duplicate label error.
mov r0, #1
bx lr
.global call1234
call1234:}}
{{HintBox|One optimization that can be done to functions whose last action is to return the result of a function call is to set up the function parameters, then use a standard branch (rather than branch-and-link) to call the function. Because you didn't use branch-and-link, the function you "called" will directly return to your caller, which reduces the number of function return instructions executed. This optimization is called [http://en.wikipedia.org/wiki/Tail_call tail call elimination].
Using tail call optimization in this problem also allows you to avoid saving and restoring the link register.}}
{{SubmitBox|arch=arm}}
38d4c8835cf4c6a754d2cb373da3b1264055bea9
Arm/callsave
0
56
612
219
2017-11-07T07:52:52Z
Henry
1
wikitext
text/x-wiki
Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how many of its four original parameters are equal to the return value of <tt>secret(1,2,3,4)</tt>. Since there are 4 parameters, <tt>call1234</tt> will only ever return 0 through 4. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 (int a, int b, int c, int d) {
n = secret(1,2,3,4);
return (How many of {a, b, c, d} are equal to n);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r4</tt>. The purpose of this problem is to exercise saving and restoring registers. You need to use the (caller-saved) function parameters passed to you, yet you must reuse the same registers to pass parameters to a function you call.
{{ExampleBox|1=call1234(10,10,20,30)|2=2, if secret(1,2,3,4) returns 10|3=
.global _start
ldr sp, =0x40000000
mov r0, #10
mov r1, #10
mov r2, #20
mov r3, #30
bl call1234
1: b 1b
//secret: // For debugging, uncomment this label
// Don't submit with this label though, or you will get a duplicate label error.
mov r0, #10
bx lr
.global call1234
call1234:}}
{{SubmitBox|arch=arm}}
7868bd14ce5a4bb8421c77cf7cbf3d1bab3bffc9
635
612
2017-11-27T19:04:41Z
Henry
1
wikitext
text/x-wiki
Write a function with four parameters named <tt>call1234</tt> that calls the function <tt>secret</tt> with four parameters with values 1, 2, 3, and 4. It should return how many of its four original parameters are equal to the return value of <tt>secret(1,2,3,4)</tt>. Since there are 4 parameters, <tt>call1234</tt> will only ever return 0 through 4. The function <tt>secret</tt> is provided for you: Your submitted code should not contain that function, or you will end up calling your version rather than the one that is provided for you.
<syntaxhighlight lang="c">
int call1234 (int a, int b, int c, int d) {
n = secret(1,2,3,4);
return (How many of {a, b, c, d} are equal to n);
}
</syntaxhighlight>
Recall that the first 4 parameters to a function are passed through registers <tt>r0</tt> through <tt>r3</tt>. The purpose of this problem is to exercise saving and restoring registers. You need to use the (caller-saved) function parameters passed to you, yet you must reuse the same registers to pass parameters to a function you call.
{{ExampleBox|1=call1234(10,10,20,30)|2=2, if secret(1,2,3,4) returns 10|3=
.global _start
ldr sp, =0x40000000
mov r0, #10
mov r1, #10
mov r2, #20
mov r3, #30
bl call1234
1: b 1b
//secret: // For debugging, uncomment this label
// Don't submit with this label though, or you will get a duplicate label error.
mov r0, #10
bx lr
.global call1234
call1234:}}
{{SubmitBox|arch=arm}}
57d3b2a8e2d6ed2a0c14d9e2d07350a8ce80f50d
Arm/loadexec
0
227
613
579
2017-11-07T07:53:11Z
Henry
1
wikitext
text/x-wiki
Write a function that will copy a block of code (assumed to be a function) to a given location in memory, then call the function, passing it one integer parameter.
<source lang="c">void loadexec( int(*dest)(int), int(*src)(int), unsigned int code_length, int param);</source>
The block of code is located at location ''src'', with length ''code_length'' bytes. This block of code should be copied to ''dest''. After copying, execute the code at ''dest'' and pass it parameter ''param'', and returning its return value (i.e., with ''dest'' as a function pointer, do <tt>return dest(param)</tt>)
{{ExampleBox|[See below]|2=r0=8| 3=
// Some testing code
// When debugging in CPUlator, turn off the following debugging checks:
// - Instruction fetch: Modified opcode
// - Instruction fetch: Outside a code section (If Dest is outside the .text section)
Src:
add r0, r0, r0 // This function returns double its parameter.
bx lr
Dest:
.skip 8 // Make space for the code
.global _start
_start:
ldr r0, =Dest
ldr r1, =Src
ldr r2, =8 // There are 2 instructions to copy: 8 bytes
ldr r3, =4 // Let's call the function with parameter 4
bl loadexec
1: b 1b // done
// Your function starts here:
loadexec: }}
{{HintBox|Due to the stringent debug checks used by this simulator, don't use <tt>pop {pc}</tt> unless the intention is to return from a function.}}
{{SubmitBox|arch=arm}}
90c18ddafbfaf2cf5f01f668b73f7d5af663c43a
Arm/ifelse1
0
232
614
586
2017-11-07T07:56:08Z
Henry
1
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
You are provided the functions <tt>odd</tt> and <tt>even</tt>. To make the problem easier, these two functions do not clobber any registers.
{{ExampleBox|1|[no output, odd() is called]|3=
// Some testing code
// You may uncomment these during testing, but comment them out before submitting
// odd: bx lr
// even: bx lr
.global _start
_start:
ldr r0, =1 // First function parameter is always passed through r4.
bl oddeven
1: b 1b // Done
oddeven:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return. (This can be shortened to pop {pc} )
pop {lr}
bx lr
}}
{{SubmitBox|arch=arm}}
5c0467b72cef25e8f5aaf1ce76feed1e0ed5f8de
642
614
2017-11-27T19:09:42Z
Henry
1
wikitext
text/x-wiki
Write a function that determines whether its parameter is odd, then calls <tt>odd</tt> or <tt>even</tt> depending on whether the number is odd or even.
<syntaxhighlight lang="c">void oddeven (int n);</syntaxhighlight>
You are provided the functions <tt>odd</tt> and <tt>even</tt>. To make the problem easier, these two functions do not clobber any registers.
{{ExampleBox|1|[no output, odd() is called]|3=
// Some testing code
// You may uncomment these during testing, but comment them out before submitting
// odd: bx lr
// even: bx lr
.global _start
_start:
ldr r0, =1 // First function parameter is always passed through r0.
bl oddeven
1: b 1b // Done
oddeven:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return. (This can be shortened to pop {pc} )
pop {lr}
bx lr
}}
{{SubmitBox|arch=arm}}
0fbd15176f1d1c175963d0523c9478561d64b6f2
MediaWiki:Sidebar
8
4
615
548
2017-11-07T17:52:29Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II simulator
** https://cpulator.01xz.net/arm|CPUlator — ARMv7 simulator
* SEARCH
* TOOLBOX
* LANGUAGES
3606bf09508fd766f00ffb148f5d03d881f0212f
Arm index
0
19
616
479
2017-11-07T17:57:54Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add">Add</vlgstat>
*<vlgstat tc="arm/shiftu">Shift logical</vlgstat>
*<vlgstat tc="arm/shifts">Shift arithmetic</vlgstat>
*<vlgstat tc="arm/shiftl">Shift left</vlgstat>
<!-- tiling: Removed because it requires division -->
==== Bit manipulation ====
*<vlgstat tc="arm/pow2">Power of 2?</vlgstat>
*<vlgstat tc="arm/mask">Bit mask</vlgstat>
*<vlgstat tc="arm/mask2">Bit mask</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="arm/signext">Sign extension</vlgstat>
*<vlgstat tc="arm/zeroext">Zero extension</vlgstat>
*<vlgstat tc="arm/extend">Extending a number</vlgstat>
*<vlgstat tc="arm/saturate">Saturation</vlgstat>
*<vlgstat tc="arm/saturate2">Saturation</vlgstat>
*<vlgstat tc="arm/bits1">Number length</vlgstat>
*<vlgstat tc="arm/bits2">Number length</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load0">Load from label</vlgstat>
*<vlgstat tc="arm/load1">Load from pointer</vlgstat>
*<vlgstat tc="arm/load2">Load from array</vlgstat>
*<vlgstat tc="arm/swap">Swap</vlgstat>
*<vlgstat tc="arm/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="arm/declword">Declare words</vlgstat>
*<vlgstat tc="arm/declword4">Declare words</vlgstat>
*<vlgstat tc="arm/declblob">Declare memory</vlgstat>
*<vlgstat tc="arm/declstring">Declare string</vlgstat>
*<vlgstat tc="arm/declstrword">Declare alignment</vlgstat>
*<vlgstat tc="arm/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="arm/declequ2">Using .equ</vlgstat>
*<vlgstat tc="arm/declstruct">Declare struct</vlgstat>
*<vlgstat tc="arm/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="arm/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="arm/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="arm/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="arm/ifthen">If-then</vlgstat>
*<vlgstat tc="arm/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/maxs8">Max of array</vlgstat>
*<vlgstat tc="arm/mins">Min of array</vlgstat>
*<vlgstat tc="arm/maxu">Max of array</vlgstat>
*<vlgstat tc="arm/peak">Max, min</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memcpy">Copy memory</vlgstat>
*<vlgstat tc="arm/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="arm/structstore">Write to struct</vlgstat>
*<vlgstat tc="arm/structfind">Array search</vlgstat>
*<vlgstat tc="arm/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="arm/findstack">Where is: stack</vlgstat>
*<vlgstat tc="arm/findlabel">Where is: label</vlgstat>
*<vlgstat tc="arm/findfunction">Where is: function</vlgstat>
*<vlgstat tc="arm/findme">Where is: your function</vlgstat>
*<vlgstat tc="arm/findcaller">Where is: caller</vlgstat>
<!-- findintr: Interrupt controller is more complex -->
*<vlgstat tc="arm/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="arm/random">Random numbers</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="arm/hex1">Print hex character</vlgstat>
*<vlgstat tc="arm/hexstr">Print hex string</vlgstat>
*<vlgstat tc="arm/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="arm/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="arm/decstr1">Decimal string</vlgstat>
*<vlgstat tc="arm/decstr2">Decimal string</vlgstat>
*<vlgstat tc="arm/bcd2">Binary-coded decimal</vlgstat>
<!-- bcd8: Removed because it requires division -->
*<vlgstat tc="arm/normalize">Normalize array</vlgstat>
*<vlgstat tc="arm/arraysum">Sum array</vlgstat>
*<vlgstat tc="arm/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="arm/accum1">Calculator</vlgstat>
*<vlgstat tc="arm/accum2">Calculator</vlgstat>
*<vlgstat tc="arm/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="arm/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="arm/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="arm/cacheblock">Cache block</vlgstat>
*<vlgstat tc="arm/cacheset">Cache set</vlgstat>
*<vlgstat tc="arm/cacheset2">Cache set</vlgstat>
*<vlgstat tc="arm/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="arm/cachetag">Cache tag</vlgstat>
*<vlgstat tc="arm/cachehit">One cache hit</vlgstat>
*<vlgstat tc="arm/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="arm/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="arm/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="arm/memsize">Memory capacity</vlgstat>
<!-- memtiling: Removed because it requires division -->
*<vlgstat tc="arm/memenable">Chip enable</vlgstat>
*<vlgstat tc="arm/memenable2">Chip enables</vlgstat>
0d9762e8f706639a7181836493ddb5b65b2ffcee
651
616
2017-12-01T19:31:43Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add">Add</vlgstat>
*<vlgstat tc="arm/shiftu">Shift logical</vlgstat>
*<vlgstat tc="arm/shifts">Shift arithmetic</vlgstat>
*<vlgstat tc="arm/shiftl">Shift left</vlgstat>
<!-- tiling: Removed because it requires division -->
==== Bit manipulation ====
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/pow2">Power of 2?</vlgstat>
*<vlgstat tc="arm/mask">Bit mask</vlgstat>
*<vlgstat tc="arm/mask2">Bit mask</vlgstat>
*<vlgstat tc="arm/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="arm/signext">Sign extension</vlgstat>
*<vlgstat tc="arm/zeroext">Zero extension</vlgstat>
*<vlgstat tc="arm/extend">Extending a number</vlgstat>
*<vlgstat tc="arm/saturate">Saturation</vlgstat>
*<vlgstat tc="arm/saturate2">Saturation</vlgstat>
*<vlgstat tc="arm/bits1">Number length</vlgstat>
*<vlgstat tc="arm/bits2">Number length</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load0">Load from label</vlgstat>
*<vlgstat tc="arm/load1">Load from pointer</vlgstat>
*<vlgstat tc="arm/load2">Load from array</vlgstat>
*<vlgstat tc="arm/swap">Swap</vlgstat>
*<vlgstat tc="arm/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="arm/declword">Declare words</vlgstat>
*<vlgstat tc="arm/declword4">Declare words</vlgstat>
*<vlgstat tc="arm/declblob">Declare memory</vlgstat>
*<vlgstat tc="arm/declstring">Declare string</vlgstat>
*<vlgstat tc="arm/declstrword">Declare alignment</vlgstat>
*<vlgstat tc="arm/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="arm/declequ2">Using .equ</vlgstat>
*<vlgstat tc="arm/declstruct">Declare struct</vlgstat>
*<vlgstat tc="arm/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="arm/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="arm/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="arm/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="arm/ifthen">If-then</vlgstat>
*<vlgstat tc="arm/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/maxs8">Max of array</vlgstat>
*<vlgstat tc="arm/mins">Min of array</vlgstat>
*<vlgstat tc="arm/maxu">Max of array</vlgstat>
*<vlgstat tc="arm/peak">Max, min</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memcpy">Copy memory</vlgstat>
*<vlgstat tc="arm/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="arm/structstore">Write to struct</vlgstat>
*<vlgstat tc="arm/structfind">Array search</vlgstat>
*<vlgstat tc="arm/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="arm/findstack">Where is: stack</vlgstat>
*<vlgstat tc="arm/findlabel">Where is: label</vlgstat>
*<vlgstat tc="arm/findfunction">Where is: function</vlgstat>
*<vlgstat tc="arm/findme">Where is: your function</vlgstat>
*<vlgstat tc="arm/findcaller">Where is: caller</vlgstat>
<!-- findintr: Interrupt controller is more complex -->
*<vlgstat tc="arm/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="arm/random">Random numbers</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="arm/hex1">Print hex character</vlgstat>
*<vlgstat tc="arm/hexstr">Print hex string</vlgstat>
*<vlgstat tc="arm/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="arm/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="arm/decstr1">Decimal string</vlgstat>
*<vlgstat tc="arm/decstr2">Decimal string</vlgstat>
*<vlgstat tc="arm/bcd2">Binary-coded decimal</vlgstat>
<!-- bcd8: Removed because it requires division -->
*<vlgstat tc="arm/normalize">Normalize array</vlgstat>
*<vlgstat tc="arm/arraysum">Sum array</vlgstat>
*<vlgstat tc="arm/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="arm/accum1">Calculator</vlgstat>
*<vlgstat tc="arm/accum2">Calculator</vlgstat>
*<vlgstat tc="arm/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="arm/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="arm/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="arm/cacheblock">Cache block</vlgstat>
*<vlgstat tc="arm/cacheset">Cache set</vlgstat>
*<vlgstat tc="arm/cacheset2">Cache set</vlgstat>
*<vlgstat tc="arm/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="arm/cachetag">Cache tag</vlgstat>
*<vlgstat tc="arm/cachehit">One cache hit</vlgstat>
*<vlgstat tc="arm/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="arm/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="arm/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="arm/memsize">Memory capacity</vlgstat>
<!-- memtiling: Removed because it requires division -->
*<vlgstat tc="arm/memenable">Chip enable</vlgstat>
*<vlgstat tc="arm/memenable2">Chip enables</vlgstat>
1b340d24fc666eba2ca2501b87199266d4c71b2f
HDLBits:ProblemMenu
3072
89
617
500
2017-11-07T17:58:19Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift logical</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift left</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load from label</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load from pointer</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load from array</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Normalize array</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Multiple memory devices</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-shiftu"><vlgstat icon="first" tc="arm/shiftu">Shift logical</vlgstat></li><li id="pmenui_arm-shifts"><vlgstat icon="first" tc="arm/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_arm-shiftl"><vlgstat icon="first" tc="arm/shiftl">Shift left</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_arm-pow2"><vlgstat icon="first" tc="arm/pow2">Power of 2?</vlgstat></li><li id="pmenui_arm-mask"><vlgstat icon="first" tc="arm/mask">Bit mask</vlgstat></li><li id="pmenui_arm-mask2"><vlgstat icon="first" tc="arm/mask2">Bit mask</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-bswap"><vlgstat icon="first" tc="arm/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_arm-signext"><vlgstat icon="first" tc="arm/signext">Sign extension</vlgstat></li><li id="pmenui_arm-zeroext"><vlgstat icon="first" tc="arm/zeroext">Zero extension</vlgstat></li><li id="pmenui_arm-extend"><vlgstat icon="first" tc="arm/extend">Extending a number</vlgstat></li><li id="pmenui_arm-saturate"><vlgstat icon="first" tc="arm/saturate">Saturation</vlgstat></li><li id="pmenui_arm-saturate2"><vlgstat icon="first" tc="arm/saturate2">Saturation</vlgstat></li><li id="pmenui_arm-bits1"><vlgstat icon="first" tc="arm/bits1">Number length</vlgstat></li><li id="pmenui_arm-bits2"><vlgstat icon="first" tc="arm/bits2">Number length</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load0"><vlgstat icon="first" tc="arm/load0">Load from label</vlgstat></li><li id="pmenui_arm-load1"><vlgstat icon="first" tc="arm/load1">Load from pointer</vlgstat></li><li id="pmenui_arm-load2"><vlgstat icon="first" tc="arm/load2">Load from array</vlgstat></li><li id="pmenui_arm-swap"><vlgstat icon="first" tc="arm/swap">Swap</vlgstat></li><li id="pmenui_arm-chrcpy"><vlgstat icon="first" tc="arm/chrcpy">Copy byte</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_arm-declword"><vlgstat icon="first" tc="arm/declword">Declare words</vlgstat></li><li id="pmenui_arm-declword4"><vlgstat icon="first" tc="arm/declword4">Declare words</vlgstat></li><li id="pmenui_arm-declblob"><vlgstat icon="first" tc="arm/declblob">Declare memory</vlgstat></li><li id="pmenui_arm-declstring"><vlgstat icon="first" tc="arm/declstring">Declare string</vlgstat></li><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">Declare alignment</vlgstat></li><li id="pmenui_arm-declequ"><vlgstat icon="first" tc="arm/declequ">Declaring .equ</vlgstat></li><li id="pmenui_arm-declequ2"><vlgstat icon="first" tc="arm/declequ2">Using .equ</vlgstat></li><li id="pmenui_arm-declstruct"><vlgstat icon="first" tc="arm/declstruct">Declare struct</vlgstat></li><li id="pmenui_arm-declstruct2"><vlgstat icon="first" tc="arm/declstruct2">Declare struct</vlgstat></li><li id="pmenui_arm-declblob2"><vlgstat icon="first" tc="arm/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_arm-loaddecl1"><vlgstat icon="first" tc="arm/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl2"><vlgstat icon="first" tc="arm/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl3"><vlgstat icon="first" tc="arm/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl4"><vlgstat icon="first" tc="arm/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_arm-ifelse1"><vlgstat icon="first" tc="arm/ifelse1">If-then-else</vlgstat></li><li id="pmenui_arm-ifthen"><vlgstat icon="first" tc="arm/ifthen">If-then</vlgstat></li><li id="pmenui_arm-ifelse2"><vlgstat icon="first" tc="arm/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-maxs8"><vlgstat icon="first" tc="arm/maxs8">Max of array</vlgstat></li><li id="pmenui_arm-mins"><vlgstat icon="first" tc="arm/mins">Min of array</vlgstat></li><li id="pmenui_arm-maxu"><vlgstat icon="first" tc="arm/maxu">Max of array</vlgstat></li><li id="pmenui_arm-peak"><vlgstat icon="first" tc="arm/peak">Max, min</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-arrayinsert"><vlgstat icon="first" tc="arm/arrayinsert">Array insert</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory</vlgstat></li><li id="pmenui_arm-square"><vlgstat icon="first" tc="arm/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_arm-structstore"><vlgstat icon="first" tc="arm/structstore">Write to struct</vlgstat></li><li id="pmenui_arm-structfind"><vlgstat icon="first" tc="arm/structfind">Array search</vlgstat></li><li id="pmenui_arm-structsort"><vlgstat icon="first" tc="arm/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-sum-args20"><vlgstat icon="first" tc="arm/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_arm-findstack"><vlgstat icon="first" tc="arm/findstack">Where is: stack</vlgstat></li><li id="pmenui_arm-findlabel"><vlgstat icon="first" tc="arm/findlabel">Where is: label</vlgstat></li><li id="pmenui_arm-findfunction"><vlgstat icon="first" tc="arm/findfunction">Where is: function</vlgstat></li><li id="pmenui_arm-findme"><vlgstat icon="first" tc="arm/findme">Where is: your function</vlgstat></li><li id="pmenui_arm-findcaller"><vlgstat icon="first" tc="arm/findcaller">Where is: caller</vlgstat></li><li id="pmenui_arm-loadexec"><vlgstat icon="first" tc="arm/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_arm-random"><vlgstat icon="first" tc="arm/random">Random numbers</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_arm-hex1"><vlgstat icon="first" tc="arm/hex1">Print hex character</vlgstat></li><li id="pmenui_arm-hexstr"><vlgstat icon="first" tc="arm/hexstr">Print hex string</vlgstat></li><li id="pmenui_arm-7seg"><vlgstat icon="first" tc="arm/7seg">Seven-segment display</vlgstat></li><li id="pmenui_arm-7seg8"><vlgstat icon="first" tc="arm/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_arm-decstr1"><vlgstat icon="first" tc="arm/decstr1">Decimal string</vlgstat></li><li id="pmenui_arm-decstr2"><vlgstat icon="first" tc="arm/decstr2">Decimal string</vlgstat></li><li id="pmenui_arm-bcd2"><vlgstat icon="first" tc="arm/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_arm-normalize"><vlgstat icon="first" tc="arm/normalize">Normalize array</vlgstat></li><li id="pmenui_arm-arraysum"><vlgstat icon="first" tc="arm/arraysum">Sum array</vlgstat></li><li id="pmenui_arm-subarraysum"><vlgstat icon="first" tc="arm/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_arm-accum1"><vlgstat icon="first" tc="arm/accum1">Calculator</vlgstat></li><li id="pmenui_arm-accum2"><vlgstat icon="first" tc="arm/accum2">Calculator</vlgstat></li><li id="pmenui_arm-manhattan"><vlgstat icon="first" tc="arm/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_arm-uartread"><vlgstat icon="first" tc="arm/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_arm-cacheblock"><vlgstat icon="first" tc="arm/cacheblock">Cache block</vlgstat></li><li id="pmenui_arm-cacheset"><vlgstat icon="first" tc="arm/cacheset">Cache set</vlgstat></li><li id="pmenui_arm-cacheset2"><vlgstat icon="first" tc="arm/cacheset2">Cache set</vlgstat></li><li id="pmenui_arm-cacheset3"><vlgstat icon="first" tc="arm/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_arm-cachetag"><vlgstat icon="first" tc="arm/cachetag">Cache tag</vlgstat></li><li id="pmenui_arm-cachehit"><vlgstat icon="first" tc="arm/cachehit">One cache hit</vlgstat></li><li id="pmenui_arm-cachehits"><vlgstat icon="first" tc="arm/cachehits">Many cache hits</vlgstat></li><li id="pmenui_arm-cachehits2"><vlgstat icon="first" tc="arm/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_arm-memaddr"><vlgstat icon="first" tc="arm/memaddr">Memory address lines</vlgstat></li><li id="pmenui_arm-memsize"><vlgstat icon="first" tc="arm/memsize">Memory capacity</vlgstat></li><li id="pmenui_arm-memenable"><vlgstat icon="first" tc="arm/memenable">Chip enable</vlgstat></li><li id="pmenui_arm-memenable2"><vlgstat icon="first" tc="arm/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li></ul>
f76617d452aa98c21631b4c0ff20899e0af9bdb7
Project:About
4
43
618
270
2017-11-07T22:30:34Z
Henry
1
wikitext
text/x-wiki
ASMBits is a collection of short assembly-language programming exercises and an online judge. The immediate feedback provided by an online judge is useful for practice: Learning something well requires many repetitions of making and correcting errors, and immediate feedback makes this process faster.
Program submissions are run through the [https://cpulator.01xz.net/ CPUlator] instruction-set simulator, then compared with the results produced by our reference solution. In addition to checking for the correct answer, ASMBits performs the same checks for adherence to various coding practices and conventions (e.g., forbidding self-modifying code) as in the interactive version of the CPUlator simulator.
=== Instruction Sets ===
The Nios II and ARMv7 instruction sets are taught in various courses at the University of Toronto, Thus, there are currently two sets of nearly-identical exercises, one for Nios II and one for ARMv7.
=== Topics ===
The problem set are based on the topics taught in ECE243 and ECE253 at the University of Toronto, the two courses I am most familiar with as a teaching assistant for 7 years. A course in computer organization covers topics beyond just "programming". Thus, some of the exercises (e.g., about caches) aren't strictly "programming", but are exercises whose solutions can be cast into an assembly-language program.
460c47d0e424eed2bda9e3d2bf9ff70aac67cf22
Main Page
0
1
619
93
2017-11-07T22:53:45Z
Henry
1
wikitext
text/x-wiki
__NOTOC__
{{NoTitle}}
== ASMBits — Assembly Language Practice ==
ASMBits is a collection of small assembly language programming exercises. There are currently exercises for ARMv7 and Nios II architectures.
Most of the problems require you to write a function in assembly language.
ASMBits runs your code with a few test input cases, and the results are compared to those produced by our reference solution.
=== How to use ASMBits ===
# Choose an instruction set: [[Nios_index|'''Nios II''']] or [[Arm_index|'''ARMv7''']]
# Choose an exercise. For example, <vlgstat tc="nios/return">Return from function (Nios II)</vlgstat> or <vlgstat tc="arm/return">Return from function (ARMv7)</vlgstat>
# Write a solution and debug it
# Submit
If you want to [[Special:VlgStats/Me|'''track your progress''']] or move to another browser, [[Special:VlgProfile|'''create a username and password''']] so you can [[Special:VlgLogin|'''log in''']] from elsewhere.
=== Which exercises should I do? ===
The exercises are organized by topic and by approximately difficulty within each topic. Start first with the "Getting Started" section to get familiar with how to use ASMBits. Then start with the easier problems of each topic. The "More short programs" exercises aren't necessarily more difficult, but they can cover multiple topics so they don't fit neatly into one specific section.
19ad3905aef3ffbe764b83d693f8e349fab569d2
631
619
2017-11-17T23:42:25Z
Henry
1
wikitext
text/x-wiki
__NOTOC__
{{NoTitle}}
== ASMBits — Assembly Language Practice ==
ASMBits is a collection of small assembly language programming exercises. There are currently exercises for ARMv7 and Nios II architectures.
Most of the problems require you to write a function in assembly language.
ASMBits runs your code with a few test input cases, and the results are compared to those produced by our reference solution.
=== How to use ASMBits ===
# Choose an instruction set: [[Nios_index|'''Nios II''']] or [[Arm_index|'''ARMv7''']]
# Choose an exercise. For example, <vlgstat tc="nios/return">Return from function (Nios II)</vlgstat> or <vlgstat tc="arm/return">Return from function (ARMv7)</vlgstat>
# Write a solution and debug it
# Submit
If you want to [[Special:VlgStats/Me|'''track your progress''']] or move to another browser, [[Special:VlgProfile|'''create a username and password''']] so you can [[Special:VlgLogin|'''log in''']] from elsewhere.
=== Which exercises should I do? ===
The exercises are organized by topic and by approximately difficulty within each topic. Start first with the "Getting Started" section to get familiar with how to use ASMBits. Then start with the easier problems of each topic. The "More short programs" exercises aren't necessarily more difficult, but they can cover multiple topics so they don't fit neatly into one specific section.
== Problem Sets ==
{{:Topics}}
e40541927a1364e840cdb8747b4ab2aea291cfde
Nios/return
0
57
620
259
2017-11-15T03:30:47Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, if your function doesn't return correctly, or if it takes too long to run, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
# This is for testing your function
call func # Call your function
# Your function should return here.
1: br 1b # Infinite loop to stop program after testing
.global func
func:
# This is where your code starts running when judging.
# Write a function here.
}}
{{HintBox|Nios II uses the <tt>ret</tt> instruction to return from a function}}
{{SubmitBox|arch=nios2}}
16f2d41842c8d4d45b486abeee11d24b984aef68
Arm/return123
0
16
621
127
2017-11-15T03:31:08Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r0) is 123
* Your function returns to the caller (The return address is <tt>lr</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
bl func
1: b 1b // done
.global func
func:
// return 123: Set r0 = 123 and then return from the function.
}}
{{SubmitBox|arch=arm}}
464f633737bc7a33c9d9f0fca7a6d6c5e9f38bb8
Arm/return
0
44
622
252
2017-11-15T03:44:54Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{HintBox|ARM has several common ways to return from a function:
* <tt>mov pc, lr</tt>
* <tt>bx lr</tt>
* <tt>push {lr} ; ... ; pop {pc}</tt>
The ARMv7-A Architecture Reference Manual recommends against using the first option (because it can only switch modes from ARM to Thumb, while the latter two can switch processor modes in both directions.}}
{{SubmitBox|arch=arm}}
13e70bdb3e28661467e7366442b44d8ee85834ce
623
622
2017-11-15T03:51:34Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{HintBox|1=ARM has several common ways to return from a function:
* <tt>mov pc, lr</tt>
* <tt>bx lr</tt>
* <tt>push {lr} ; ... ; pop {pc}</tt>
The ARMv7-A Architecture Reference Manual ([https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf#page=160 section A4.1.1]) recommends against using the first option (because it can only switch modes from ARM to Thumb, while the latter two can switch processor modes in both directions.}}
{{SubmitBox|arch=arm}}
e44e42491f0886c8056598d360f9f4198108ef8b
624
623
2017-11-15T03:51:59Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
.global func
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{HintBox|1=ARM has several common ways to return from a function:
* <tt>mov pc, lr</tt>
* <tt>bx lr</tt>
* <tt>push {lr} ; ... ; pop {pc}</tt>
The ARMv7-A Architecture Reference Manual ([https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf#page=160 section A4.1.1]) recommends against using the first option because it can only switch modes from ARM to Thumb, while the latter two can switch processor modes in both directions.}}
{{SubmitBox|arch=arm}}
497c874ab340c73bbb983baaf91239fa614a64d9
MediaWiki:Foreground.css
8
5
625
295
2017-11-15T06:08:54Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Roboto:300,300i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Roboto", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Roboto", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Roboto", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu {
margin-top: 2em;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
}
div#pmenu_menu::before {
content: "";
}
}
c9c03aaca58adea88285e0e4f34533157b8b3712
626
625
2017-11-17T22:55:00Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Roboto:300,300i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Roboto", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Roboto", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Roboto", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
max-width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em;}
div.htableform table { margin: auto; max-width: 24em; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu {
margin-top: 2em;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
}
div#pmenu_menu::before {
content: "";
}
}
f31eee23547b18437dffe72aa2dec552cceb5e96
627
626
2017-11-17T23:01:51Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Roboto:300,300i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Roboto", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Roboto", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Roboto", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
max-width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em 2em;}
div.htableform table { margin: auto; width:100%; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu {
margin-top: 2em;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
}
div#pmenu_menu::before {
content: "";
}
}
8a3b3ea97e1ca163719c34f8a3b5db787bf23e01
HDLBits:LoginPage
3072
2
628
2
2017-11-17T23:07:47Z
Henry
1
wikitext
text/x-wiki
<html>
<style>
div#hloginbox td#hcuser { text-align: center; padding: 1.5em; font-weight: bold;}
</style>
<div id="hloginbox" class="htableform">
<form method="post"><table></html>{{#if:{{{user|}}}|<html><tr><td id="hcuser">Logged in as </html>{{{user}}}<html>.</td></tr><tr><td style="text-align: right;"></html>[[Special:VlgProfile|Profile settings...]]<html><input type="submit" name="logout" value="Logout"></td></tr></html>|<html>
<tr><td>Username:</td><td><input type="text" name="vlg_username"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password"></td></tr>
<tr><td colspan=2 style="text-align: right;"></html>[[Special:VlgProfile|Create profile...]]<html><input type="submit" name="login" value="Login"></td></tr></html>}}{{#if:{{{msg|}}}|<html><tr><td colspan=2><b></html>{{{msg}}}<html></b></td></tr></html>|}}<html></table></form></div>
</html>
<noinclude>
This page belongs to the namespace {{NAMESPACE}}. It is used to show the user the HDLBits login and log out pages.
Parameters:
; user: If set, this is the currently logged-in user. The logout page should be shown. If not set, show the login page.
; msg : An extra message to be displayed, such as "Invalid login or password"
</noinclude>
ae771cf008c1c62766105af07cedccaf2b611eac
Topics
0
253
629
2017-11-17T23:40:29Z
Henry
1
Created page with "<html> <style> div.panel { border: 1px #ccc solid; background: #fcfeff; margin: 0.5em 1.5em; display: block; } div.panel { padding: 0.75em; } div.panel a {..."
wikitext
text/x-wiki
<html>
<style>
div.panel {
border: 1px #ccc solid;
background: #fcfeff;
margin: 0.5em 1.5em;
display: block;
}
div.panel {
padding: 0.75em;
}
div.panel a {
color: #000;
}
div.panel a:hover {
color: #2ba6cb;
}
div.panel div.head {
font-size:1.25em;
line-height: 42px;
font-weight: bold;
display:block;
}
div.panel div.head a {
padding: 0.5em 3em 0.5em 0.5em;
white-space: nowrap;
}
div.panel img {
display:block;
float:left;
margin-right: 0.6em;
width: 60px;
height: 42px;
}
</style></html>
<div class="panel"><div class="head">[[Nios_index|Problems for Nios II]]</div>
</div>
<div class="panel"><div class="head">[[Arm_index|Problems for ARMv7]]</div>
</div>
280d24ae5d95e26b6d579a856e89d914f5716a69
630
629
2017-11-17T23:42:15Z
Henry
1
wikitext
text/x-wiki
<html>
<style>
div.panel {
border: 1px #ccc solid;
background: #fcfeff;
margin: 0.5em 1.5em;
display: block;
}
div.panel {
padding: 0.75em;
}
div.panel a {
color: #000;
}
div.panel a:hover {
color: #2ba6cb;
}
div.panel div.head {
font-size:1.25em;
line-height: 42px;
font-weight: bold;
display:block;
}
div.panel div.head a {
padding: 0 0 0 0.5em;
white-space: nowrap;
display: block;
}
div.panel img {
display:block;
float:left;
margin-right: 0.6em;
width: 60px;
height: 42px;
}
</style></html>
<div class="panel"><div class="head">[[Nios_index|Problems for Nios II]]</div>
</div>
<div class="panel"><div class="head">[[Arm_index|Problems for ARMv7]]</div>
</div>
127238818185a17d807d5c26a4ee14b6357d4b0e
Arm/7seg8
0
229
632
582
2017-11-27T19:03:28Z
Henry
1
wikitext
text/x-wiki
Write a function that will return a 64-bit value that can be used to display a 32-bit number as 8 hexadecimal digits, on 8 seven-segment displays. The 8 displays are separated into two groups of four, with each group of four being controlled by a 32-bit bit pattern (as four groups of 8 bits, with the highest bit of each byte unused).
<ul><li>bit[6:0]: right-most digit</li>
<li>bit[14:8]</li>
<li>bit[22:16]</li>
<li>bit[30:24]: left-most digit</li></ul>
<source lang="c">unsigned long long hexdisplay(unsigned int number);</source>
Your function will be passed one parameter: The number to be displayed. It should return the 64-bit bit pattern in r0 (least-significant 32 bits) and r1 (most-significant 32 bits).
Use the following bit patterns for digits. You may wish to reuse <vlgstat tc="arm/7seg"/>.
[[File:7seg.png]]
{{ExampleBox|1=r0=8|2=r1=0x3f3f3f3f, r0=0x3f3f3f7f| 3=
// Some testing code
.global _start
_start:
ldr r0, =8
bl hexdisplay
1: b 1b // done
// Your function starts here:
hexdisplay: }}
{{SubmitBox|arch=arm}}
c96b630b672fd2bf4e41e3c20ee8839bdb4da0c3
Arm/normalize
0
204
633
541
2017-11-27T19:03:52Z
Henry
1
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r0: The number of elements in the input (and output) array</li>
<li>r1: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r2: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
There is no return value.
<source lang="c">void normalize(unsigned int length, const unsigned int *input, unsigned int *output);</source>
You may wish to reuse your solutions to <vlgstat tc="arm/maxu"/> and <vlgstat tc="arm/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
// A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
ldr r0, =4
ldr r1, =Input
ldr r2, =Output
bl normalize
b _start // End of testing code
// Normalize to U16
normalize:
}}
{{SubmitBox|arch=arm}}
8f16a9593c620a7deb74c68c77776dcfbddf1520
Arm/signext
0
185
636
515
2017-11-27T19:07:40Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
{{ExampleBox|0xf0|0xfffffff0|3=
// A test case to test your function with
.global _start
_start:
mov r0, #0xf0 // First parameter is always in r0
bl signext
b _start // End of testing code
// A function to sign extend. Only this part will be tested.
signext:
}}
{{SubmitBox|arch=arm}}
f372fcc72d8386417f8f8d653b5906898ed7205b
Arm/zeroext
0
186
637
516
2017-11-27T19:07:53Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
{{ExampleBox|0xf0|0x000000f0|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0xf0 // First parameter is always in r0
bl zeroext
b _start // End of testing code
// A function to zero extend. Only this part will be tested.
zeroext:
}}
{{SubmitBox|arch=arm}}
52aa42740ca655d459f75e3b9ff77d3d135098ab
Arm/saturate
0
188
638
519
2017-11-27T19:08:06Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around.
Write a function that will convert an unsigned 32-bit number to 16 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the maximum possible unsigned 16-bit value.
{{ExampleBox|0x12345|0xffff|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x12345 // First parameter is always in r0
bl saturate
b _start // End of testing code
// Convert unsigned 32 bit to 16 bit, with saturation
saturate:
}}
{{SubmitBox|arch=arm}}
cc1513fa7ea2b3aec9b733f8a4ee5af69337c11a
Arm/saturate2
0
189
639
520
2017-11-27T19:08:18Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around.
Write a function that will convert a signed 32-bit number to (signed) 8 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the closest possible signed 8-bit value. Since the output is an 8 bit value, the upper 24 bits of the return value should be zero.
{{ExampleBox|0x123|0x7f|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x123 // First parameter is always in r0
bl saturate
b _start // End of testing code
// Convert signed 32 bit to 8 bit, with saturation
saturate:
}}
{{SubmitBox|arch=arm}}
83821e3008569d7bba51018cb28d369c25378fb6
Arm/load1
0
209
640
552
2017-11-27T19:08:37Z
Henry
1
wikitext
text/x-wiki
Your function will be passed a pointer to a 32-bit word. Write a function that reads this word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer);</syntaxhighlight>
{{ExampleBox|1=r0=Data
|2=r0=0x123|3=
Data: .word 0x123
.global _start
_start:
ldr r0, =Data
bl load
1: b 1b // Done
// Dereference a pointer
load:}}
{{SubmitBox|arch=arm}}
6fd1eb9e5297b5f68da17127d21acda5aa25f4c3
Arm/load2
0
210
641
553
2017-11-27T19:08:57Z
Henry
1
wikitext
text/x-wiki
Your function will be passed a pointer to the start of an array of 32-bit words, and an array index. Write a function that reads the index<sup>th</sup> word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer, int index);</syntaxhighlight>
{{ExampleBox|1=r0=Data, r1=1
|2=r0=0x124|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
ldr r0, =Data
ldr r1, =1
bl load
1: b 1b // Done
// Dereference a pointer
load:}}
{{SubmitBox|arch=nios2}}
2121cc252e4ef945a80027bc4876b386f31d9009
Arm/ifelse2
0
233
643
587
2017-11-27T19:10:03Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r0=5|2=add_a and done are called|3=
// Some testing code
// You may uncomment these during testing
// add_a: bx lr
// add_b: bx lr
// add_c: bx lr
// add_d: bx lr
// add_e: bx lr
// done: bx lr
.global _start
_start:
ldr r0, =5 // First function parameter is always passed through r0.
bl build
1: b 1b // Done
build:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return.
pop {pc}
}}
{{SubmitBox|arch=nios2}}
9d048c1f6190113d3aa7b45827dda8e97e93307c
Arm/declequ
0
181
644
511
2017-11-27T19:13:49Z
Henry
1
wikitext
text/x-wiki
The <tt>.equ</tt> directive is useful for creating named constants that can be used in your code, rather than directly using plain numbers.
Using <tt>.equ</tt>, declare a constant named LEDS with value 0xff200000 (This is the location of the LED I/O device). Then write a function named <tt>get_led</tt> that returns the value of LEDs in r0. (This is just 32-bit-move-constant (ldr reg, =NUM) to practice using the constant.)
{{ExampleBox|[No input]|2=r0=0xff200000 |3=
// Insert declarations here
.global get_led
// A function that returns the value of LEDS
get_led:
}}
{{SubmitBox|arch=arm}}
efdd1c17d9304eb2ff869a9bfb69b41dee55a656
Arm/chrcpy
0
212
645
555
2017-11-27T19:14:28Z
Henry
1
wikitext
text/x-wiki
Write a function that will copy one character from a string to a second string. Your function will be passed four parameters: The first two parameters specify the source string and character position. The third and fourth parameters specify the destination string and character position. Copy the character. (Don't consider null-termination, overflows, etc.)
<syntaxhighlight lang="c">int chrcpy (char *src, int src_pos, char *dst, int dst_pos);</syntaxhighlight>
{{ExampleBox|chrcpy("hello", 1, "bye", 1)|
|2="bye" -> "bee"|3=
.data
Src: .string "hello"
.align 2 // Insert padding so it's easier to read.
Dst: .string "bye"
.text
.global _start
_start:
ldr r0, =Src
ldr r1, =1
ldr r2, =Dst
ldr r3, =1
bl chrcpy
1: b 1b // Done
// Copy a character from one string to another
chrcpy:}}
{{SubmitBox|arch=arm}}
d982118f681b72a5b28ec23fd5146f4dbfcd4538
Arm/findlabel
0
223
646
574
2017-11-27T19:14:47Z
Henry
1
wikitext
text/x-wiki
Write a function that will return the location pointed to by the label <tt>Waldo</tt>.
{{ExampleBox|[none]|2=r0=0x04000000| 3=
// Some testing code
// Make sure to submit without "Waldo" defined in your code, or you will get a "multiple definition" error.
// Waldo: .string "Where's Waldo??"
.global _start
_start:
bl where
1: b 1b // done
// Your function starts here:
where: }}
{{SubmitBox|arch=arm}}
6f7130cccc3b2b427c7567de004a8c1dc807a604
Arm/accum1
0
230
647
583
2017-11-27T19:15:22Z
Henry
1
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication), following instructions encoded in an array of bytes.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>null: Return from the function and return the current Accumulator value in r2.</li></ol>
For example, the (null-terminated) string "+0+@-P" encodes 4 operations:
<ol><li>"+0": Add 0x30 to the accumulator. The accumulator starts off as 0, and now contains 0x30</li>
<li>"+@": Add 0x40 to the accumulator. The accumulator now contains 0x70</li>
<li>"-P": Subtract 0x50 from the accumulator. The accumulator now contains 0x20</li>
<li>null: Quit. The function returns 0x20 in r0</li>
</ol>
Similarly, the following will compute 100*100:
<source lang="gas">.byte '+', 100, '*', 100, 0</source>
Starting with an accumulator with 0, add 100, then multiply by 100, then return the result.
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|"+0+@-P"|2=r0=0x20| 3=
// Some testing code
.data
Cmd: .string "+0+@-P"
.text
.global _start
_start:
ldr r0, =Cmd
bl calc
1: b 1b // done
// Your function starts here:
calc: }}
{{SubmitBox|arch=arm}}
062f5ccb09fff0a18d261a77ce45f61d97ed299c
648
647
2017-11-27T19:15:44Z
Henry
1
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication), following instructions encoded in an array of bytes.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>null: Return from the function and return the current Accumulator value in r0.</li></ol>
For example, the (null-terminated) string "+0+@-P" encodes 4 operations:
<ol><li>"+0": Add 0x30 to the accumulator. The accumulator starts off as 0, and now contains 0x30</li>
<li>"+@": Add 0x40 to the accumulator. The accumulator now contains 0x70</li>
<li>"-P": Subtract 0x50 from the accumulator. The accumulator now contains 0x20</li>
<li>null: Quit. The function returns 0x20 in r0</li>
</ol>
Similarly, the following will compute 100*100:
<source lang="gas">.byte '+', 100, '*', 100, 0</source>
Starting with an accumulator with 0, add 100, then multiply by 100, then return the result.
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|"+0+@-P"|2=r0=0x20| 3=
// Some testing code
.data
Cmd: .string "+0+@-P"
.text
.global _start
_start:
ldr r0, =Cmd
bl calc
1: b 1b // done
// Your function starts here:
calc: }}
{{SubmitBox|arch=arm}}
f32c313e6b4b40999c6a573b47dc0fc74bd45576
Arm/accum2
0
231
649
584
2017-11-27T19:16:19Z
Henry
1
wikitext
text/x-wiki
Write a function that performs a sequence of calculations (addition, subtraction, multiplication, conditional branch), following instructions encoded in an array of bytes. This is an extension of <vlgstat tc="Nios/accum1"/>, by adding two conditional branch instructions.
This calculator is based on a single 32-bit "accumulator": A 32-bit value that all of the operations will operate on. Set the accumulator to zero at the beginning of your function.
Your function will be passed one parameter: A pointer to the beginning of the byte array. In the byte array, every two bytes encode an instruction. The first byte is a character that indicates which operation to perform ('+', '-', '*', 'b', 'B', or null), and the second byte is an ''8-bit signed'' operand (Note that the accumulator is 32 bits). Implement the following 4 operations:
<ol>
<li>'+': Accumulator <= Accumulator + operand</li>
<li>'-': Accumulator <= Accumulator - operand</li>
<li>'*': Accumulator <= Accumulator * operand</li>
<li>'b': '''If Accumulator < 0''', then skip over ''operand'' instructions and keep going. ''operand'' = 0 means continue with the following instruction, while ''operand'' = -1 means go backwards one instruction (equivalent to repeating the 'b' instruction forever.). '''If accumulator >= 0''', then do nothing and continue reading the next instruction.</li>
<li>'B': This is exactly the same as 'b', but with the condition reversed. Branch if accumulator >= 0.</li>
<li>null: Return from the function and return the current Accumulator value in r0.</li></ol>
For example the following will compute 1+3:
<source lang="gas">.byte '+', 1, 'B', 1, '+', 2, '+', 3, 0</source>
Starting with an accumulator with 0, add 1, then skip over 1 instruction because the accumulator is non-negative, then add 3. (The "add 2" is skipped over because the branch-if-non-negative occurred with an accumulator of 1)
But the following will compute 1+2+3, because the branch-if-negative is not taken:
<source lang="gas">.byte '+', 1, 'b', 1, '+', 2, '+', 3, 0</source>
Write a function that will process the sequence of instructions and return the final value of the accumulator.
{{ExampleBox|+ 1, B 1, + 2, + 3|2=r0=0x4| 3=
// Some testing code
.data
Cmd: .byte '+', 1, 'B', 1, '+', 2, '+', 3, 0
Cmd2: .byte '+', 1, 'b', 1, '+', 2, '+', 3, 0
.text
.global _start
_start:
ldr r0, =Cmd
bl calc
1: b 1b // done
// Your function starts here:
calc: }}
{{SubmitBox|arch=arm}}
c81efd795fcc04771cb972bf3ce4d4e9ec106230
Nios/return123
0
17
650
196
2017-11-27T19:17:03Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r2) is 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r2 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
call func
1: br 1b # done
.global func
func:
# Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
fd98d63bd11524b7cf226cf8dce8930acf53ab4f
Nios index
0
18
652
499
2017-12-01T19:31:49Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift logical</vlgstat>
*<vlgstat tc="nios/shifts">Shift arithmetic</vlgstat>
*<vlgstat tc="nios/shiftl">Shift left</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
6185888bf3a67a96ad1137c3610c006a8b2b12ef
659
652
2017-12-10T03:40:09Z
Henry
1
/* Problem Set for Nios II */
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for Nios II==
</noinclude>
=== Getting Started ===
*<vlgstat tc="nios/return">Return from function</vlgstat>
*<vlgstat tc="nios/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="nios/invert">Bitwise invert</vlgstat>
*<vlgstat tc="nios/odd">Odd or even</vlgstat>
*<vlgstat tc="nios/abs">Absolute value</vlgstat>
*<vlgstat tc="nios/add">Add</vlgstat>
*<vlgstat tc="nios/shiftu">Shift logical</vlgstat>
*<vlgstat tc="nios/shifts">Shift arithmetic</vlgstat>
*<vlgstat tc="nios/shiftl">Shift left</vlgstat>
*<vlgstat tc="nios/tiling">Tiling a rectangle</vlgstat>
==== Bit manipulation ====
*<vlgstat tc="nios/bswap">Byte swap</vlgstat>
*<vlgstat tc="nios/popcount">Population count</vlgstat>
*<vlgstat tc="nios/pow2">Power of 2?</vlgstat>
*<vlgstat tc="nios/mask">Bit mask</vlgstat>
*<vlgstat tc="nios/mask2">Bit mask</vlgstat>
==== Number representation ====
*<vlgstat tc="nios/zeroext">Zero extension</vlgstat>
*<vlgstat tc="nios/signext">Sign extension</vlgstat>
*<vlgstat tc="nios/extend">Extending a number</vlgstat>
*<vlgstat tc="nios/saturate">Saturation</vlgstat>
*<vlgstat tc="nios/saturate2">Saturation</vlgstat>
*<vlgstat tc="nios/bits1">Number length</vlgstat>
*<vlgstat tc="nios/bits2">Number length</vlgstat>
*<vlgstat tc="nios/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="nios/load">Load from memory</vlgstat>
*<vlgstat tc="nios/load0">Load from label</vlgstat>
*<vlgstat tc="nios/load1">Load from pointer</vlgstat>
*<vlgstat tc="nios/load2">Load from array</vlgstat>
*<vlgstat tc="nios/swap">Swap</vlgstat>
*<vlgstat tc="nios/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="nios/load_align">Unaligned load</vlgstat>
*<vlgstat tc="nios/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="nios/declword">Declare words</vlgstat>
*<vlgstat tc="nios/declword4">Declare words</vlgstat>
*<vlgstat tc="nios/declblob">Declare memory</vlgstat>
*<vlgstat tc="nios/declstring">Declare string</vlgstat>
*<vlgstat tc="nios/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="nios/declequ2">Using .equ</vlgstat>
*<vlgstat tc="nios/declstruct">Declare struct</vlgstat>
*<vlgstat tc="nios/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="nios/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="nios/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="nios/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="nios/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="nios/ifthen">If-then</vlgstat>
*<vlgstat tc="nios/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="nios/strlen">String length</vlgstat>
*<vlgstat tc="nios/strtolower">String lower case</vlgstat>
*<vlgstat tc="nios/maxs8">Max of array</vlgstat>
*<vlgstat tc="nios/mins">Min of array</vlgstat>
*<vlgstat tc="nios/maxu">Max of array</vlgstat>
*<vlgstat tc="nios/peak">Max, min</vlgstat>
*<vlgstat tc="nios/array_inc">Array increment</vlgstat>
*<vlgstat tc="nios/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="nios/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="nios/linklist_len">Linked list</vlgstat>
*<vlgstat tc="nios/memcpy">Copy memory</vlgstat>
*<vlgstat tc="nios/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="nios/structstore">Write to struct</vlgstat>
*<vlgstat tc="nios/structfind">Array search</vlgstat>
*<vlgstat tc="nios/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="nios/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="nios/callparam">Calling a function</vlgstat>
*<vlgstat tc="nios/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="nios/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="nios/callsave">Saving registers</vlgstat>
*<vlgstat tc="nios/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="nios/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="nios/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="nios/treesize">Binary tree size</vlgstat>
*<vlgstat tc="nios/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="nios/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="nios/findstack">Where is: stack</vlgstat>
*<vlgstat tc="nios/findlabel">Where is: label</vlgstat>
*<vlgstat tc="nios/findfunction">Where is: function</vlgstat>
*<vlgstat tc="nios/findme">Where is: your function</vlgstat>
*<vlgstat tc="nios/findcaller">Where is: caller</vlgstat>
*<vlgstat tc="nios/findintr">Interrupt enabled</vlgstat>
*<vlgstat tc="nios/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="nios/random">Random numbers</vlgstat>
*<vlgstat tc="nios/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="nios/hex1">Print hex character</vlgstat>
*<vlgstat tc="nios/hexstr">Print hex string</vlgstat>
*<vlgstat tc="nios/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="nios/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="nios/decstr1">Decimal string</vlgstat>
*<vlgstat tc="nios/decstr2">Decimal string</vlgstat>
*<vlgstat tc="nios/bcd2">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/bcd8">Binary-coded decimal</vlgstat>
*<vlgstat tc="nios/normalize">Normalize array</vlgstat>
*<vlgstat tc="nios/arraysum">Sum array</vlgstat>
*<vlgstat tc="nios/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="nios/accum1">Calculator</vlgstat>
*<vlgstat tc="nios/accum2">Calculator</vlgstat>
*<vlgstat tc="nios/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="nios/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="nios/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="nios/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="nios/cacheblock">Cache block</vlgstat>
*<vlgstat tc="nios/cacheset">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset2">Cache set</vlgstat>
*<vlgstat tc="nios/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="nios/cachetag">Cache tag</vlgstat>
*<vlgstat tc="nios/cachehit">One cache hit</vlgstat>
*<vlgstat tc="nios/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="nios/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="nios/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="nios/memsize">Memory capacity</vlgstat>
*<vlgstat tc="nios/memtiling">Multiple memory devices</vlgstat>
*<vlgstat tc="nios/memenable">Chip enable</vlgstat>
*<vlgstat tc="nios/memenable2">Chip enables</vlgstat>
c6f06ca0f6772ac812b0dc06b63dbbd60f8a1000
HDLBits:ProblemMenu
3072
89
653
617
2017-12-01T19:31:59Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift logical</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift left</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load from label</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load from pointer</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load from array</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Normalize array</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Multiple memory devices</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-shiftu"><vlgstat icon="first" tc="arm/shiftu">Shift logical</vlgstat></li><li id="pmenui_arm-shifts"><vlgstat icon="first" tc="arm/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_arm-shiftl"><vlgstat icon="first" tc="arm/shiftl">Shift left</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-pow2"><vlgstat icon="first" tc="arm/pow2">Power of 2?</vlgstat></li><li id="pmenui_arm-mask"><vlgstat icon="first" tc="arm/mask">Bit mask</vlgstat></li><li id="pmenui_arm-mask2"><vlgstat icon="first" tc="arm/mask2">Bit mask</vlgstat></li><li id="pmenui_arm-bswap"><vlgstat icon="first" tc="arm/bswap">Byte swap</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_arm-signext"><vlgstat icon="first" tc="arm/signext">Sign extension</vlgstat></li><li id="pmenui_arm-zeroext"><vlgstat icon="first" tc="arm/zeroext">Zero extension</vlgstat></li><li id="pmenui_arm-extend"><vlgstat icon="first" tc="arm/extend">Extending a number</vlgstat></li><li id="pmenui_arm-saturate"><vlgstat icon="first" tc="arm/saturate">Saturation</vlgstat></li><li id="pmenui_arm-saturate2"><vlgstat icon="first" tc="arm/saturate2">Saturation</vlgstat></li><li id="pmenui_arm-bits1"><vlgstat icon="first" tc="arm/bits1">Number length</vlgstat></li><li id="pmenui_arm-bits2"><vlgstat icon="first" tc="arm/bits2">Number length</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load0"><vlgstat icon="first" tc="arm/load0">Load from label</vlgstat></li><li id="pmenui_arm-load1"><vlgstat icon="first" tc="arm/load1">Load from pointer</vlgstat></li><li id="pmenui_arm-load2"><vlgstat icon="first" tc="arm/load2">Load from array</vlgstat></li><li id="pmenui_arm-swap"><vlgstat icon="first" tc="arm/swap">Swap</vlgstat></li><li id="pmenui_arm-chrcpy"><vlgstat icon="first" tc="arm/chrcpy">Copy byte</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_arm-declword"><vlgstat icon="first" tc="arm/declword">Declare words</vlgstat></li><li id="pmenui_arm-declword4"><vlgstat icon="first" tc="arm/declword4">Declare words</vlgstat></li><li id="pmenui_arm-declblob"><vlgstat icon="first" tc="arm/declblob">Declare memory</vlgstat></li><li id="pmenui_arm-declstring"><vlgstat icon="first" tc="arm/declstring">Declare string</vlgstat></li><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">Declare alignment</vlgstat></li><li id="pmenui_arm-declequ"><vlgstat icon="first" tc="arm/declequ">Declaring .equ</vlgstat></li><li id="pmenui_arm-declequ2"><vlgstat icon="first" tc="arm/declequ2">Using .equ</vlgstat></li><li id="pmenui_arm-declstruct"><vlgstat icon="first" tc="arm/declstruct">Declare struct</vlgstat></li><li id="pmenui_arm-declstruct2"><vlgstat icon="first" tc="arm/declstruct2">Declare struct</vlgstat></li><li id="pmenui_arm-declblob2"><vlgstat icon="first" tc="arm/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_arm-loaddecl1"><vlgstat icon="first" tc="arm/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl2"><vlgstat icon="first" tc="arm/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl3"><vlgstat icon="first" tc="arm/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl4"><vlgstat icon="first" tc="arm/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_arm-ifelse1"><vlgstat icon="first" tc="arm/ifelse1">If-then-else</vlgstat></li><li id="pmenui_arm-ifthen"><vlgstat icon="first" tc="arm/ifthen">If-then</vlgstat></li><li id="pmenui_arm-ifelse2"><vlgstat icon="first" tc="arm/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-maxs8"><vlgstat icon="first" tc="arm/maxs8">Max of array</vlgstat></li><li id="pmenui_arm-mins"><vlgstat icon="first" tc="arm/mins">Min of array</vlgstat></li><li id="pmenui_arm-maxu"><vlgstat icon="first" tc="arm/maxu">Max of array</vlgstat></li><li id="pmenui_arm-peak"><vlgstat icon="first" tc="arm/peak">Max, min</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-arrayinsert"><vlgstat icon="first" tc="arm/arrayinsert">Array insert</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory</vlgstat></li><li id="pmenui_arm-square"><vlgstat icon="first" tc="arm/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_arm-structstore"><vlgstat icon="first" tc="arm/structstore">Write to struct</vlgstat></li><li id="pmenui_arm-structfind"><vlgstat icon="first" tc="arm/structfind">Array search</vlgstat></li><li id="pmenui_arm-structsort"><vlgstat icon="first" tc="arm/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-sum-args20"><vlgstat icon="first" tc="arm/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_arm-findstack"><vlgstat icon="first" tc="arm/findstack">Where is: stack</vlgstat></li><li id="pmenui_arm-findlabel"><vlgstat icon="first" tc="arm/findlabel">Where is: label</vlgstat></li><li id="pmenui_arm-findfunction"><vlgstat icon="first" tc="arm/findfunction">Where is: function</vlgstat></li><li id="pmenui_arm-findme"><vlgstat icon="first" tc="arm/findme">Where is: your function</vlgstat></li><li id="pmenui_arm-findcaller"><vlgstat icon="first" tc="arm/findcaller">Where is: caller</vlgstat></li><li id="pmenui_arm-loadexec"><vlgstat icon="first" tc="arm/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_arm-random"><vlgstat icon="first" tc="arm/random">Random numbers</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_arm-hex1"><vlgstat icon="first" tc="arm/hex1">Print hex character</vlgstat></li><li id="pmenui_arm-hexstr"><vlgstat icon="first" tc="arm/hexstr">Print hex string</vlgstat></li><li id="pmenui_arm-7seg"><vlgstat icon="first" tc="arm/7seg">Seven-segment display</vlgstat></li><li id="pmenui_arm-7seg8"><vlgstat icon="first" tc="arm/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_arm-decstr1"><vlgstat icon="first" tc="arm/decstr1">Decimal string</vlgstat></li><li id="pmenui_arm-decstr2"><vlgstat icon="first" tc="arm/decstr2">Decimal string</vlgstat></li><li id="pmenui_arm-bcd2"><vlgstat icon="first" tc="arm/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_arm-normalize"><vlgstat icon="first" tc="arm/normalize">Normalize array</vlgstat></li><li id="pmenui_arm-arraysum"><vlgstat icon="first" tc="arm/arraysum">Sum array</vlgstat></li><li id="pmenui_arm-subarraysum"><vlgstat icon="first" tc="arm/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_arm-accum1"><vlgstat icon="first" tc="arm/accum1">Calculator</vlgstat></li><li id="pmenui_arm-accum2"><vlgstat icon="first" tc="arm/accum2">Calculator</vlgstat></li><li id="pmenui_arm-manhattan"><vlgstat icon="first" tc="arm/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_arm-uartread"><vlgstat icon="first" tc="arm/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_arm-cacheblock"><vlgstat icon="first" tc="arm/cacheblock">Cache block</vlgstat></li><li id="pmenui_arm-cacheset"><vlgstat icon="first" tc="arm/cacheset">Cache set</vlgstat></li><li id="pmenui_arm-cacheset2"><vlgstat icon="first" tc="arm/cacheset2">Cache set</vlgstat></li><li id="pmenui_arm-cacheset3"><vlgstat icon="first" tc="arm/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_arm-cachetag"><vlgstat icon="first" tc="arm/cachetag">Cache tag</vlgstat></li><li id="pmenui_arm-cachehit"><vlgstat icon="first" tc="arm/cachehit">One cache hit</vlgstat></li><li id="pmenui_arm-cachehits"><vlgstat icon="first" tc="arm/cachehits">Many cache hits</vlgstat></li><li id="pmenui_arm-cachehits2"><vlgstat icon="first" tc="arm/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_arm-memaddr"><vlgstat icon="first" tc="arm/memaddr">Memory address lines</vlgstat></li><li id="pmenui_arm-memsize"><vlgstat icon="first" tc="arm/memsize">Memory capacity</vlgstat></li><li id="pmenui_arm-memenable"><vlgstat icon="first" tc="arm/memenable">Chip enable</vlgstat></li><li id="pmenui_arm-memenable2"><vlgstat icon="first" tc="arm/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li></ul>
68f8cf32d65615f10d0f8e26cabf4fe2f61eaba7
661
653
2017-12-10T03:40:28Z
HDLBits Extension
2
wikitext
text/x-wiki
<ul id="pmenu_top"><li>Nios II<ul><li>Getting Started<ul><li id="pmenui_nios-return"><vlgstat icon="first" tc="nios/return">Return from function</vlgstat></li><li id="pmenui_nios-return123"><vlgstat icon="first" tc="nios/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_nios-invert"><vlgstat icon="first" tc="nios/invert">Bitwise invert</vlgstat></li><li id="pmenui_nios-odd"><vlgstat icon="first" tc="nios/odd">Odd or even</vlgstat></li><li id="pmenui_nios-abs"><vlgstat icon="first" tc="nios/abs">Absolute value</vlgstat></li><li id="pmenui_nios-add"><vlgstat icon="first" tc="nios/add">Add</vlgstat></li><li id="pmenui_nios-shiftu"><vlgstat icon="first" tc="nios/shiftu">Shift logical</vlgstat></li><li id="pmenui_nios-shifts"><vlgstat icon="first" tc="nios/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_nios-shiftl"><vlgstat icon="first" tc="nios/shiftl">Shift left</vlgstat></li><li id="pmenui_nios-tiling"><vlgstat icon="first" tc="nios/tiling">Tiling a rectangle</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_nios-bswap"><vlgstat icon="first" tc="nios/bswap">Byte swap</vlgstat></li><li id="pmenui_nios-popcount"><vlgstat icon="first" tc="nios/popcount">Population count</vlgstat></li><li id="pmenui_nios-pow2"><vlgstat icon="first" tc="nios/pow2">Power of 2?</vlgstat></li><li id="pmenui_nios-mask"><vlgstat icon="first" tc="nios/mask">Bit mask</vlgstat></li><li id="pmenui_nios-mask2"><vlgstat icon="first" tc="nios/mask2">Bit mask</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_nios-zeroext"><vlgstat icon="first" tc="nios/zeroext">Zero extension</vlgstat></li><li id="pmenui_nios-signext"><vlgstat icon="first" tc="nios/signext">Sign extension</vlgstat></li><li id="pmenui_nios-extend"><vlgstat icon="first" tc="nios/extend">Extending a number</vlgstat></li><li id="pmenui_nios-saturate"><vlgstat icon="first" tc="nios/saturate">Saturation</vlgstat></li><li id="pmenui_nios-saturate2"><vlgstat icon="first" tc="nios/saturate2">Saturation</vlgstat></li><li id="pmenui_nios-bits1"><vlgstat icon="first" tc="nios/bits1">Number length</vlgstat></li><li id="pmenui_nios-bits2"><vlgstat icon="first" tc="nios/bits2">Number length</vlgstat></li><li id="pmenui_nios-add64"><vlgstat icon="first" tc="nios/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_nios-load"><vlgstat icon="first" tc="nios/load">Load from memory</vlgstat></li><li id="pmenui_nios-load0"><vlgstat icon="first" tc="nios/load0">Load from label</vlgstat></li><li id="pmenui_nios-load1"><vlgstat icon="first" tc="nios/load1">Load from pointer</vlgstat></li><li id="pmenui_nios-load2"><vlgstat icon="first" tc="nios/load2">Load from array</vlgstat></li><li id="pmenui_nios-swap"><vlgstat icon="first" tc="nios/swap">Swap</vlgstat></li><li id="pmenui_nios-chrcpy"><vlgstat icon="first" tc="nios/chrcpy">Copy byte</vlgstat></li><li id="pmenui_nios-load-align"><vlgstat icon="first" tc="nios/load_align">Unaligned load</vlgstat></li><li id="pmenui_nios-increment-align"><vlgstat icon="first" tc="nios/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_nios-declword"><vlgstat icon="first" tc="nios/declword">Declare words</vlgstat></li><li id="pmenui_nios-declword4"><vlgstat icon="first" tc="nios/declword4">Declare words</vlgstat></li><li id="pmenui_nios-declblob"><vlgstat icon="first" tc="nios/declblob">Declare memory</vlgstat></li><li id="pmenui_nios-declstring"><vlgstat icon="first" tc="nios/declstring">Declare string</vlgstat></li><li id="pmenui_nios-declequ"><vlgstat icon="first" tc="nios/declequ">Declaring .equ</vlgstat></li><li id="pmenui_nios-declequ2"><vlgstat icon="first" tc="nios/declequ2">Using .equ</vlgstat></li><li id="pmenui_nios-declstruct"><vlgstat icon="first" tc="nios/declstruct">Declare struct</vlgstat></li><li id="pmenui_nios-declstruct2"><vlgstat icon="first" tc="nios/declstruct2">Declare struct</vlgstat></li><li id="pmenui_nios-declblob2"><vlgstat icon="first" tc="nios/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_nios-loaddecl1"><vlgstat icon="first" tc="nios/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl2"><vlgstat icon="first" tc="nios/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl3"><vlgstat icon="first" tc="nios/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_nios-loaddecl4"><vlgstat icon="first" tc="nios/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_nios-ifelse1"><vlgstat icon="first" tc="nios/ifelse1">If-then-else</vlgstat></li><li id="pmenui_nios-ifthen"><vlgstat icon="first" tc="nios/ifthen">If-then</vlgstat></li><li id="pmenui_nios-ifelse2"><vlgstat icon="first" tc="nios/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_nios-strlen"><vlgstat icon="first" tc="nios/strlen">String length</vlgstat></li><li id="pmenui_nios-strtolower"><vlgstat icon="first" tc="nios/strtolower">String lower case</vlgstat></li><li id="pmenui_nios-maxs8"><vlgstat icon="first" tc="nios/maxs8">Max of array</vlgstat></li><li id="pmenui_nios-mins"><vlgstat icon="first" tc="nios/mins">Min of array</vlgstat></li><li id="pmenui_nios-maxu"><vlgstat icon="first" tc="nios/maxu">Max of array</vlgstat></li><li id="pmenui_nios-peak"><vlgstat icon="first" tc="nios/peak">Max, min</vlgstat></li><li id="pmenui_nios-array-inc"><vlgstat icon="first" tc="nios/array_inc">Array increment</vlgstat></li><li id="pmenui_nios-arrayinsert"><vlgstat icon="first" tc="nios/arrayinsert">Array insert</vlgstat></li><li id="pmenui_nios-linklist-del"><vlgstat icon="first" tc="nios/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_nios-linklist-len"><vlgstat icon="first" tc="nios/linklist_len">Linked list</vlgstat></li><li id="pmenui_nios-memcpy"><vlgstat icon="first" tc="nios/memcpy">Copy memory</vlgstat></li><li id="pmenui_nios-square"><vlgstat icon="first" tc="nios/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_nios-structstore"><vlgstat icon="first" tc="nios/structstore">Write to struct</vlgstat></li><li id="pmenui_nios-structfind"><vlgstat icon="first" tc="nios/structfind">Array search</vlgstat></li><li id="pmenui_nios-structsort"><vlgstat icon="first" tc="nios/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_nios-func-pack3"><vlgstat icon="first" tc="nios/func_pack3">Function parameters</vlgstat></li><li id="pmenui_nios-callparam"><vlgstat icon="first" tc="nios/callparam">Calling a function</vlgstat></li><li id="pmenui_nios-sum-args20"><vlgstat icon="first" tc="nios/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_nios-func-pack20"><vlgstat icon="first" tc="nios/func_pack20">More function parameters</vlgstat></li><li id="pmenui_nios-callsave"><vlgstat icon="first" tc="nios/callsave">Saving registers</vlgstat></li><li id="pmenui_nios-sum-args"><vlgstat icon="first" tc="nios/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_nios-max-args"><vlgstat icon="first" tc="nios/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_nios-fib1"><vlgstat icon="first" tc="nios/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_nios-fib2"><vlgstat icon="first" tc="nios/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_nios-treesize"><vlgstat icon="first" tc="nios/treesize">Binary tree size</vlgstat></li><li id="pmenui_nios-treedepth"><vlgstat icon="first" tc="nios/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_nios-ackermann"><vlgstat icon="first" tc="nios/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_nios-findstack"><vlgstat icon="first" tc="nios/findstack">Where is: stack</vlgstat></li><li id="pmenui_nios-findlabel"><vlgstat icon="first" tc="nios/findlabel">Where is: label</vlgstat></li><li id="pmenui_nios-findfunction"><vlgstat icon="first" tc="nios/findfunction">Where is: function</vlgstat></li><li id="pmenui_nios-findme"><vlgstat icon="first" tc="nios/findme">Where is: your function</vlgstat></li><li id="pmenui_nios-findcaller"><vlgstat icon="first" tc="nios/findcaller">Where is: caller</vlgstat></li><li id="pmenui_nios-findintr"><vlgstat icon="first" tc="nios/findintr">Interrupt enabled</vlgstat></li><li id="pmenui_nios-loadexec"><vlgstat icon="first" tc="nios/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_nios-random"><vlgstat icon="first" tc="nios/random">Random numbers</vlgstat></li><li id="pmenui_nios-hailstone"><vlgstat icon="first" tc="nios/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_nios-hex1"><vlgstat icon="first" tc="nios/hex1">Print hex character</vlgstat></li><li id="pmenui_nios-hexstr"><vlgstat icon="first" tc="nios/hexstr">Print hex string</vlgstat></li><li id="pmenui_nios-7seg"><vlgstat icon="first" tc="nios/7seg">Seven-segment display</vlgstat></li><li id="pmenui_nios-7seg8"><vlgstat icon="first" tc="nios/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_nios-decstr1"><vlgstat icon="first" tc="nios/decstr1">Decimal string</vlgstat></li><li id="pmenui_nios-decstr2"><vlgstat icon="first" tc="nios/decstr2">Decimal string</vlgstat></li><li id="pmenui_nios-bcd2"><vlgstat icon="first" tc="nios/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-bcd8"><vlgstat icon="first" tc="nios/bcd8">Binary-coded decimal</vlgstat></li><li id="pmenui_nios-normalize"><vlgstat icon="first" tc="nios/normalize">Normalize array</vlgstat></li><li id="pmenui_nios-arraysum"><vlgstat icon="first" tc="nios/arraysum">Sum array</vlgstat></li><li id="pmenui_nios-subarraysum"><vlgstat icon="first" tc="nios/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_nios-accum1"><vlgstat icon="first" tc="nios/accum1">Calculator</vlgstat></li><li id="pmenui_nios-accum2"><vlgstat icon="first" tc="nios/accum2">Calculator</vlgstat></li><li id="pmenui_nios-manhattan"><vlgstat icon="first" tc="nios/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_nios-fib3"><vlgstat icon="first" tc="nios/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_nios-memmove"><vlgstat icon="first" tc="nios/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_nios-uartread"><vlgstat icon="first" tc="nios/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_nios-cacheblock"><vlgstat icon="first" tc="nios/cacheblock">Cache block</vlgstat></li><li id="pmenui_nios-cacheset"><vlgstat icon="first" tc="nios/cacheset">Cache set</vlgstat></li><li id="pmenui_nios-cacheset2"><vlgstat icon="first" tc="nios/cacheset2">Cache set</vlgstat></li><li id="pmenui_nios-cacheset3"><vlgstat icon="first" tc="nios/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_nios-cachetag"><vlgstat icon="first" tc="nios/cachetag">Cache tag</vlgstat></li><li id="pmenui_nios-cachehit"><vlgstat icon="first" tc="nios/cachehit">One cache hit</vlgstat></li><li id="pmenui_nios-cachehits"><vlgstat icon="first" tc="nios/cachehits">Many cache hits</vlgstat></li><li id="pmenui_nios-cachehits2"><vlgstat icon="first" tc="nios/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_nios-memaddr"><vlgstat icon="first" tc="nios/memaddr">Memory address lines</vlgstat></li><li id="pmenui_nios-memsize"><vlgstat icon="first" tc="nios/memsize">Memory capacity</vlgstat></li><li id="pmenui_nios-memtiling"><vlgstat icon="first" tc="nios/memtiling">Multiple memory devices</vlgstat></li><li id="pmenui_nios-memenable"><vlgstat icon="first" tc="nios/memenable">Chip enable</vlgstat></li><li id="pmenui_nios-memenable2"><vlgstat icon="first" tc="nios/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li><li>ARMv7<ul><li>Getting Started<ul><li id="pmenui_arm-return"><vlgstat icon="first" tc="arm/return">Return from function</vlgstat></li><li id="pmenui_arm-return123"><vlgstat icon="first" tc="arm/return123">Return 123</vlgstat></li></ul></li><li>Arithmetic<ul><li>Basic operations<ul><li id="pmenui_arm-invert"><vlgstat icon="first" tc="arm/invert">Bitwise invert</vlgstat></li><li id="pmenui_arm-odd"><vlgstat icon="first" tc="arm/odd">Odd or even</vlgstat></li><li id="pmenui_arm-abs"><vlgstat icon="first" tc="arm/abs">Absolute value</vlgstat></li><li id="pmenui_arm-add"><vlgstat icon="first" tc="arm/add">Add</vlgstat></li><li id="pmenui_arm-shiftu"><vlgstat icon="first" tc="arm/shiftu">Shift logical</vlgstat></li><li id="pmenui_arm-shifts"><vlgstat icon="first" tc="arm/shifts">Shift arithmetic</vlgstat></li><li id="pmenui_arm-shiftl"><vlgstat icon="first" tc="arm/shiftl">Shift left</vlgstat></li></ul></li><li>Bit manipulation<ul><li id="pmenui_arm-bswap"><vlgstat icon="first" tc="arm/bswap">Byte swap</vlgstat></li><li id="pmenui_arm-popcount"><vlgstat icon="first" tc="arm/popcount">Population count</vlgstat></li><li id="pmenui_arm-pow2"><vlgstat icon="first" tc="arm/pow2">Power of 2?</vlgstat></li><li id="pmenui_arm-mask"><vlgstat icon="first" tc="arm/mask">Bit mask</vlgstat></li><li id="pmenui_arm-mask2"><vlgstat icon="first" tc="arm/mask2">Bit mask</vlgstat></li></ul></li><li>Number representation<ul><li id="pmenui_arm-zeroext"><vlgstat icon="first" tc="arm/zeroext">Zero extension</vlgstat></li><li id="pmenui_arm-signext"><vlgstat icon="first" tc="arm/signext">Sign extension</vlgstat></li><li id="pmenui_arm-extend"><vlgstat icon="first" tc="arm/extend">Extending a number</vlgstat></li><li id="pmenui_arm-saturate"><vlgstat icon="first" tc="arm/saturate">Saturation</vlgstat></li><li id="pmenui_arm-saturate2"><vlgstat icon="first" tc="arm/saturate2">Saturation</vlgstat></li><li id="pmenui_arm-bits1"><vlgstat icon="first" tc="arm/bits1">Number length</vlgstat></li><li id="pmenui_arm-bits2"><vlgstat icon="first" tc="arm/bits2">Number length</vlgstat></li><li id="pmenui_arm-add64"><vlgstat icon="first" tc="arm/add64">Add with carry</vlgstat></li></ul></li></ul></li><li>Memory Operations<ul><li id="pmenui_arm-load"><vlgstat icon="first" tc="arm/load">Load from memory</vlgstat></li><li id="pmenui_arm-load0"><vlgstat icon="first" tc="arm/load0">Load from label</vlgstat></li><li id="pmenui_arm-load1"><vlgstat icon="first" tc="arm/load1">Load from pointer</vlgstat></li><li id="pmenui_arm-load2"><vlgstat icon="first" tc="arm/load2">Load from array</vlgstat></li><li id="pmenui_arm-swap"><vlgstat icon="first" tc="arm/swap">Swap</vlgstat></li><li id="pmenui_arm-chrcpy"><vlgstat icon="first" tc="arm/chrcpy">Copy byte</vlgstat></li><li id="pmenui_arm-load-align"><vlgstat icon="first" tc="arm/load_align">Unaligned load</vlgstat></li><li id="pmenui_arm-increment-align"><vlgstat icon="first" tc="arm/increment_align">Unaligned increment</vlgstat></li></ul></li><li>Declaring memory<ul><li id="pmenui_arm-declword"><vlgstat icon="first" tc="arm/declword">Declare words</vlgstat></li><li id="pmenui_arm-declword4"><vlgstat icon="first" tc="arm/declword4">Declare words</vlgstat></li><li id="pmenui_arm-declblob"><vlgstat icon="first" tc="arm/declblob">Declare memory</vlgstat></li><li id="pmenui_arm-declstring"><vlgstat icon="first" tc="arm/declstring">Declare string</vlgstat></li><li id="pmenui_arm-declstrword"><vlgstat icon="first" tc="arm/declstrword">Declare alignment</vlgstat></li><li id="pmenui_arm-declequ"><vlgstat icon="first" tc="arm/declequ">Declaring .equ</vlgstat></li><li id="pmenui_arm-declequ2"><vlgstat icon="first" tc="arm/declequ2">Using .equ</vlgstat></li><li id="pmenui_arm-declstruct"><vlgstat icon="first" tc="arm/declstruct">Declare struct</vlgstat></li><li id="pmenui_arm-declstruct2"><vlgstat icon="first" tc="arm/declstruct2">Declare struct</vlgstat></li><li id="pmenui_arm-declblob2"><vlgstat icon="first" tc="arm/declblob2">Declare memory: .org</vlgstat></li><li id="pmenui_arm-loaddecl1"><vlgstat icon="first" tc="arm/loaddecl1">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl2"><vlgstat icon="first" tc="arm/loaddecl2">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl3"><vlgstat icon="first" tc="arm/loaddecl3">Memory layout</vlgstat></li><li id="pmenui_arm-loaddecl4"><vlgstat icon="first" tc="arm/loaddecl4">Memory layout</vlgstat></li></ul></li><li>Branches<ul><li id="pmenui_arm-ifelse1"><vlgstat icon="first" tc="arm/ifelse1">If-then-else</vlgstat></li><li id="pmenui_arm-ifthen"><vlgstat icon="first" tc="arm/ifthen">If-then</vlgstat></li><li id="pmenui_arm-ifelse2"><vlgstat icon="first" tc="arm/ifelse2">If-then-else</vlgstat></li></ul></li><li>Loops and arrays<ul><li id="pmenui_arm-strlen"><vlgstat icon="first" tc="arm/strlen">String length</vlgstat></li><li id="pmenui_arm-strtolower"><vlgstat icon="first" tc="arm/strtolower">String lower case</vlgstat></li><li id="pmenui_arm-maxs8"><vlgstat icon="first" tc="arm/maxs8">Max of array</vlgstat></li><li id="pmenui_arm-mins"><vlgstat icon="first" tc="arm/mins">Min of array</vlgstat></li><li id="pmenui_arm-maxu"><vlgstat icon="first" tc="arm/maxu">Max of array</vlgstat></li><li id="pmenui_arm-peak"><vlgstat icon="first" tc="arm/peak">Max, min</vlgstat></li><li id="pmenui_arm-array-inc"><vlgstat icon="first" tc="arm/array_inc">Array increment</vlgstat></li><li id="pmenui_arm-arrayinsert"><vlgstat icon="first" tc="arm/arrayinsert">Array insert</vlgstat></li><li id="pmenui_arm-linklist-del"><vlgstat icon="first" tc="arm/linklist_del">Linked list remove</vlgstat></li><li id="pmenui_arm-linklist-len"><vlgstat icon="first" tc="arm/linklist_len">Linked list</vlgstat></li><li id="pmenui_arm-memcpy"><vlgstat icon="first" tc="arm/memcpy">Copy memory</vlgstat></li><li id="pmenui_arm-square"><vlgstat icon="first" tc="arm/square">Drawing squares</vlgstat></li></ul></li><li>Structs<ul><li id="pmenui_arm-structstore"><vlgstat icon="first" tc="arm/structstore">Write to struct</vlgstat></li><li id="pmenui_arm-structfind"><vlgstat icon="first" tc="arm/structfind">Array search</vlgstat></li><li id="pmenui_arm-structsort"><vlgstat icon="first" tc="arm/structsort">Array sort</vlgstat></li></ul></li><li>Functions and recursion<ul><li id="pmenui_arm-func-pack3"><vlgstat icon="first" tc="arm/func_pack3">Function parameters</vlgstat></li><li id="pmenui_arm-callparam"><vlgstat icon="first" tc="arm/callparam">Calling a function</vlgstat></li><li id="pmenui_arm-sum-args20"><vlgstat icon="first" tc="arm/sum_args20">Sum arguments</vlgstat></li><li id="pmenui_arm-func-pack20"><vlgstat icon="first" tc="arm/func_pack20">More function parameters</vlgstat></li><li id="pmenui_arm-callsave"><vlgstat icon="first" tc="arm/callsave">Saving registers</vlgstat></li><li id="pmenui_arm-sum-args"><vlgstat icon="first" tc="arm/sum_args">Variable arguments: sum</vlgstat></li><li id="pmenui_arm-max-args"><vlgstat icon="first" tc="arm/max_args">Variable arguments: max</vlgstat></li><li id="pmenui_arm-fib1"><vlgstat icon="first" tc="arm/fib1">Fibonacci numbers</vlgstat></li><li id="pmenui_arm-fib2"><vlgstat icon="first" tc="arm/fib2">Bigger Fibonacci numbers</vlgstat></li><li id="pmenui_arm-treesize"><vlgstat icon="first" tc="arm/treesize">Binary tree size</vlgstat></li><li id="pmenui_arm-treedepth"><vlgstat icon="first" tc="arm/treedepth">Binary tree depth</vlgstat></li><li id="pmenui_arm-ackermann"><vlgstat icon="first" tc="arm/ackermann">Ackermann function</vlgstat></li></ul></li><li>Program Structure<ul><li id="pmenui_arm-findstack"><vlgstat icon="first" tc="arm/findstack">Where is: stack</vlgstat></li><li id="pmenui_arm-findlabel"><vlgstat icon="first" tc="arm/findlabel">Where is: label</vlgstat></li><li id="pmenui_arm-findfunction"><vlgstat icon="first" tc="arm/findfunction">Where is: function</vlgstat></li><li id="pmenui_arm-findme"><vlgstat icon="first" tc="arm/findme">Where is: your function</vlgstat></li><li id="pmenui_arm-findcaller"><vlgstat icon="first" tc="arm/findcaller">Where is: caller</vlgstat></li><li id="pmenui_arm-loadexec"><vlgstat icon="first" tc="arm/loadexec">Load and Indirect call</vlgstat></li></ul></li><li>More Short Programs<ul><li id="pmenui_arm-random"><vlgstat icon="first" tc="arm/random">Random numbers</vlgstat></li><li id="pmenui_arm-hailstone"><vlgstat icon="first" tc="arm/hailstone">Hailstone sequence</vlgstat></li><li id="pmenui_arm-hex1"><vlgstat icon="first" tc="arm/hex1">Print hex character</vlgstat></li><li id="pmenui_arm-hexstr"><vlgstat icon="first" tc="arm/hexstr">Print hex string</vlgstat></li><li id="pmenui_arm-7seg"><vlgstat icon="first" tc="arm/7seg">Seven-segment display</vlgstat></li><li id="pmenui_arm-7seg8"><vlgstat icon="first" tc="arm/7seg8">Seven-segment display</vlgstat></li><li id="pmenui_arm-decstr1"><vlgstat icon="first" tc="arm/decstr1">Decimal string</vlgstat></li><li id="pmenui_arm-decstr2"><vlgstat icon="first" tc="arm/decstr2">Decimal string</vlgstat></li><li id="pmenui_arm-bcd2"><vlgstat icon="first" tc="arm/bcd2">Binary-coded decimal</vlgstat></li><li id="pmenui_arm-normalize"><vlgstat icon="first" tc="arm/normalize">Normalize array</vlgstat></li><li id="pmenui_arm-arraysum"><vlgstat icon="first" tc="arm/arraysum">Sum array</vlgstat></li><li id="pmenui_arm-subarraysum"><vlgstat icon="first" tc="arm/subarraysum">Subarray sum</vlgstat></li><li id="pmenui_arm-accum1"><vlgstat icon="first" tc="arm/accum1">Calculator</vlgstat></li><li id="pmenui_arm-accum2"><vlgstat icon="first" tc="arm/accum2">Calculator</vlgstat></li><li id="pmenui_arm-manhattan"><vlgstat icon="first" tc="arm/manhattan">Manhattan distance</vlgstat></li><li id="pmenui_arm-fib3"><vlgstat icon="first" tc="arm/fib3">Fibonacci call counting</vlgstat></li><li id="pmenui_arm-memmove"><vlgstat icon="first" tc="arm/memmove">Copy memory (overlap)</vlgstat></li></ul></li><li>Other Topics<ul><li>I/O Devices<ul><li id="pmenui_arm-uartread"><vlgstat icon="first" tc="arm/uartread">Reading from a UART</vlgstat></li></ul></li><li>Caches<ul><li id="pmenui_arm-cacheblock"><vlgstat icon="first" tc="arm/cacheblock">Cache block</vlgstat></li><li id="pmenui_arm-cacheset"><vlgstat icon="first" tc="arm/cacheset">Cache set</vlgstat></li><li id="pmenui_arm-cacheset2"><vlgstat icon="first" tc="arm/cacheset2">Cache set</vlgstat></li><li id="pmenui_arm-cacheset3"><vlgstat icon="first" tc="arm/cacheset3">Cache conflicts</vlgstat></li><li id="pmenui_arm-cachetag"><vlgstat icon="first" tc="arm/cachetag">Cache tag</vlgstat></li><li id="pmenui_arm-cachehit"><vlgstat icon="first" tc="arm/cachehit">One cache hit</vlgstat></li><li id="pmenui_arm-cachehits"><vlgstat icon="first" tc="arm/cachehits">Many cache hits</vlgstat></li><li id="pmenui_arm-cachehits2"><vlgstat icon="first" tc="arm/cachehits2">Cache simulation</vlgstat></li></ul></li><li>Memory Arrays<ul><li id="pmenui_arm-memaddr"><vlgstat icon="first" tc="arm/memaddr">Memory address lines</vlgstat></li><li id="pmenui_arm-memsize"><vlgstat icon="first" tc="arm/memsize">Memory capacity</vlgstat></li><li id="pmenui_arm-memenable"><vlgstat icon="first" tc="arm/memenable">Chip enable</vlgstat></li><li id="pmenui_arm-memenable2"><vlgstat icon="first" tc="arm/memenable2">Chip enables</vlgstat></li></ul></li></ul></li></ul></li></ul>
130905a89d686a4dd25bc22d09d59a38b1a8b62c
Arm/pow2
0
248
654
605
2017-12-01T19:34:37Z
Henry
1
wikitext
text/x-wiki
Write a function that will return whether its parameter is a power of 2. The parameter is an unsigned integer and will not be 0.
<source lang="c">int pow2(unsigned int num);</source>
{{ExampleBox|1=pow2(4)| 2=r0=1
|3=
.global _start
_start:
ldr r0, =4
bl pow2
1: b 1b // Done
pow2:}}
{{HintBox|It is possible to do this without a loop. Consider the binary representations of (2<sup>n</sup>) and (2<sup>n</sup>-1).}}
{{SubmitBox|arch=arm}}
5a561f9d177b151b97a557c75e1e907d0dd7facd
Nios/pow2
0
173
655
470
2017-12-01T19:34:43Z
Henry
1
wikitext
text/x-wiki
Write a function that will return whether its parameter is a power of 2. The parameter is an unsigned integer and will not be 0.
<source lang="c">int pow2(unsigned int num);</source>
{{ExampleBox|1=pow2(4)| 2=r2=1
|3=
.global _start
_start:
movi r4, 4
call pow2
1: br 1b # Done
pow2:}}
{{HintBox|It is possible to do this without a loop. Consider the binary representations of (2<sup>n</sup>) and (2<sup>n</sup>-1).}}
{{SubmitBox|arch=nios2}}
5cd31cfdd91fc1f79d0f08e17e859a11b1dac558
Arm/ifelse2
0
233
656
643
2017-12-08T00:35:22Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers (but condition codes can be clobbered).
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r0=5|2=add_a and done are called|3=
// Some testing code
// You may uncomment these during testing
// add_a: bx lr
// add_b: bx lr
// add_c: bx lr
// add_d: bx lr
// add_e: bx lr
// done: bx lr
.global _start
_start:
ldr r0, =5 // First function parameter is always passed through r0.
bl build
1: b 1b // Done
build:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return.
pop {pc}
}}
{{SubmitBox|arch=nios2}}
bb32cfb1fab26bb01732d709cd65e316826d6f71
Arm/popcount
0
29
657
153
2017-12-10T03:28:18Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]).
<syntaxhighlight lang="c">int popcount (int n);</syntaxhighlight>
{{ExampleBox|5
255|2
8|3=
// A test case to test your function with
.global _start
_start:
mov r0, #5
bl popcount
1: b 1b // Done
// Only your function (starting at popcount) is judged. The test code above is not executed.
popcount:}}
{{HintBox|Make sure you test all of the corner cases (What's the smallest possible answer? Largest?).}}
{{SubmitBox|arch=arm}}
a598ee57481a1c634dcc89b5157f6dac3d590c48
Nios/popcount
0
63
658
203
2017-12-10T03:29:29Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the number of 1 bits in a given 32-bit integer (also known as [https://en.wikipedia.org/wiki/Hamming_weight population count]).
<syntaxhighlight lang="c">int popcount (int n);</syntaxhighlight>
{{ExampleBox|5
255|2
8|3=
.global _start
_start:
movia r4, 5
call popcount
1: br 1b # Done
# Only your function (starting at popcount) is judged. The test code above is not executed.
popcount:}}
{{HintBox|Make sure you test all of the corner cases (What's the smallest possible answer? Largest?).}}
{{SubmitBox|arch=nios2}}
dfa38f99b3d95c55e13c605c6b9a850ca2e9c721
Arm index
0
19
660
651
2017-12-10T03:40:11Z
Henry
1
wikitext
text/x-wiki
<noinclude>{{NoTitle}}
==Problem Set for ARMv7==
</noinclude>
=== Getting Started ===
*<vlgstat tc="arm/return">Return from function</vlgstat>
*<vlgstat tc="arm/return123">Return 123</vlgstat>
=== Arithmetic ===
==== Basic operations====
*<vlgstat tc="arm/invert">Bitwise invert</vlgstat>
*<vlgstat tc="arm/odd">Odd or even</vlgstat>
*<vlgstat tc="arm/abs">Absolute value</vlgstat>
*<vlgstat tc="arm/add">Add</vlgstat>
*<vlgstat tc="arm/shiftu">Shift logical</vlgstat>
*<vlgstat tc="arm/shifts">Shift arithmetic</vlgstat>
*<vlgstat tc="arm/shiftl">Shift left</vlgstat>
<!-- tiling: Removed because it requires division -->
==== Bit manipulation ====
*<vlgstat tc="arm/bswap">Byte swap</vlgstat>
*<vlgstat tc="arm/popcount">Population count</vlgstat>
*<vlgstat tc="arm/pow2">Power of 2?</vlgstat>
*<vlgstat tc="arm/mask">Bit mask</vlgstat>
*<vlgstat tc="arm/mask2">Bit mask</vlgstat>
==== Number representation ====
*<vlgstat tc="arm/zeroext">Zero extension</vlgstat>
*<vlgstat tc="arm/signext">Sign extension</vlgstat>
*<vlgstat tc="arm/extend">Extending a number</vlgstat>
*<vlgstat tc="arm/saturate">Saturation</vlgstat>
*<vlgstat tc="arm/saturate2">Saturation</vlgstat>
*<vlgstat tc="arm/bits1">Number length</vlgstat>
*<vlgstat tc="arm/bits2">Number length</vlgstat>
*<vlgstat tc="arm/add64">Add with carry</vlgstat>
=== Memory Operations ===
*<vlgstat tc="arm/load">Load from memory</vlgstat>
*<vlgstat tc="arm/load0">Load from label</vlgstat>
*<vlgstat tc="arm/load1">Load from pointer</vlgstat>
*<vlgstat tc="arm/load2">Load from array</vlgstat>
*<vlgstat tc="arm/swap">Swap</vlgstat>
*<vlgstat tc="arm/chrcpy">Copy byte</vlgstat>
*<vlgstat tc="arm/load_align">Unaligned load</vlgstat>
*<vlgstat tc="arm/increment_align">Unaligned increment</vlgstat>
=== Declaring memory ===
*<vlgstat tc="arm/declword">Declare words</vlgstat>
*<vlgstat tc="arm/declword4">Declare words</vlgstat>
*<vlgstat tc="arm/declblob">Declare memory</vlgstat>
*<vlgstat tc="arm/declstring">Declare string</vlgstat>
*<vlgstat tc="arm/declstrword">Declare alignment</vlgstat>
*<vlgstat tc="arm/declequ">Declaring .equ</vlgstat>
*<vlgstat tc="arm/declequ2">Using .equ</vlgstat>
*<vlgstat tc="arm/declstruct">Declare struct</vlgstat>
*<vlgstat tc="arm/declstruct2">Declare struct</vlgstat>
*<vlgstat tc="arm/declblob2">Declare memory: .org</vlgstat>
*<vlgstat tc="arm/loaddecl1">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl2">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl3">Memory layout</vlgstat>
*<vlgstat tc="arm/loaddecl4">Memory layout</vlgstat>
=== Branches ===
*<vlgstat tc="arm/ifelse1">If-then-else</vlgstat>
*<vlgstat tc="arm/ifthen">If-then</vlgstat>
*<vlgstat tc="arm/ifelse2">If-then-else</vlgstat>
=== Loops and arrays ===
*<vlgstat tc="arm/strlen">String length</vlgstat>
*<vlgstat tc="arm/strtolower">String lower case</vlgstat>
*<vlgstat tc="arm/maxs8">Max of array</vlgstat>
*<vlgstat tc="arm/mins">Min of array</vlgstat>
*<vlgstat tc="arm/maxu">Max of array</vlgstat>
*<vlgstat tc="arm/peak">Max, min</vlgstat>
*<vlgstat tc="arm/array_inc">Array increment</vlgstat>
*<vlgstat tc="arm/arrayinsert">Array insert</vlgstat>
*<vlgstat tc="arm/linklist_del">Linked list remove</vlgstat>
*<vlgstat tc="arm/linklist_len">Linked list</vlgstat>
*<vlgstat tc="arm/memcpy">Copy memory</vlgstat>
*<vlgstat tc="arm/square">Drawing squares</vlgstat>
=== Structs ===
*<vlgstat tc="arm/structstore">Write to struct</vlgstat>
*<vlgstat tc="arm/structfind">Array search</vlgstat>
*<vlgstat tc="arm/structsort">Array sort</vlgstat>
=== Functions and recursion ===
*<vlgstat tc="arm/func_pack3">Function parameters</vlgstat>
*<vlgstat tc="arm/callparam">Calling a function</vlgstat>
*<vlgstat tc="arm/sum_args20">Sum arguments</vlgstat>
*<vlgstat tc="arm/func_pack20">More function parameters</vlgstat>
*<vlgstat tc="arm/callsave">Saving registers</vlgstat>
*<vlgstat tc="arm/sum_args">Variable arguments: sum</vlgstat>
*<vlgstat tc="arm/max_args">Variable arguments: max</vlgstat>
*<vlgstat tc="arm/fib1">Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/fib2">Bigger Fibonacci numbers</vlgstat>
*<vlgstat tc="arm/treesize">Binary tree size</vlgstat>
*<vlgstat tc="arm/treedepth">Binary tree depth</vlgstat>
*<vlgstat tc="arm/ackermann">Ackermann function</vlgstat>
=== Program Structure ===
*<vlgstat tc="arm/findstack">Where is: stack</vlgstat>
*<vlgstat tc="arm/findlabel">Where is: label</vlgstat>
*<vlgstat tc="arm/findfunction">Where is: function</vlgstat>
*<vlgstat tc="arm/findme">Where is: your function</vlgstat>
*<vlgstat tc="arm/findcaller">Where is: caller</vlgstat>
<!-- findintr: Interrupt controller is more complex -->
*<vlgstat tc="arm/loadexec">Load and Indirect call</vlgstat>
=== More Short Programs ===
*<vlgstat tc="arm/random">Random numbers</vlgstat>
*<vlgstat tc="arm/hailstone">Hailstone sequence</vlgstat>
*<vlgstat tc="arm/hex1">Print hex character</vlgstat>
*<vlgstat tc="arm/hexstr">Print hex string</vlgstat>
*<vlgstat tc="arm/7seg">Seven-segment display</vlgstat>
*<vlgstat tc="arm/7seg8">Seven-segment display</vlgstat>
*<vlgstat tc="arm/decstr1">Decimal string</vlgstat>
*<vlgstat tc="arm/decstr2">Decimal string</vlgstat>
*<vlgstat tc="arm/bcd2">Binary-coded decimal</vlgstat>
<!-- bcd8: Removed because it requires division -->
*<vlgstat tc="arm/normalize">Normalize array</vlgstat>
*<vlgstat tc="arm/arraysum">Sum array</vlgstat>
*<vlgstat tc="arm/subarraysum">Subarray sum</vlgstat>
*<vlgstat tc="arm/accum1">Calculator</vlgstat>
*<vlgstat tc="arm/accum2">Calculator</vlgstat>
*<vlgstat tc="arm/manhattan">Manhattan distance</vlgstat>
*<vlgstat tc="arm/fib3">Fibonacci call counting</vlgstat>
*<vlgstat tc="arm/memmove">Copy memory (overlap)</vlgstat>
=== Other Topics ===
==== I/O Devices ====
*<vlgstat tc="arm/uartread">Reading from a UART</vlgstat>
==== Caches ====
*<vlgstat tc="arm/cacheblock">Cache block</vlgstat>
*<vlgstat tc="arm/cacheset">Cache set</vlgstat>
*<vlgstat tc="arm/cacheset2">Cache set</vlgstat>
*<vlgstat tc="arm/cacheset3">Cache conflicts</vlgstat>
*<vlgstat tc="arm/cachetag">Cache tag</vlgstat>
*<vlgstat tc="arm/cachehit">One cache hit</vlgstat>
*<vlgstat tc="arm/cachehits">Many cache hits</vlgstat>
*<vlgstat tc="arm/cachehits2">Cache simulation</vlgstat>
==== Memory Arrays ====
*<vlgstat tc="arm/memaddr">Memory address lines</vlgstat>
*<vlgstat tc="arm/memsize">Memory capacity</vlgstat>
<!-- memtiling: Removed because it requires division -->
*<vlgstat tc="arm/memenable">Chip enable</vlgstat>
*<vlgstat tc="arm/memenable2">Chip enables</vlgstat>
ed6695625efdacaf5c51512d3da49239d28e3d00
Arm/loaddecl4
0
216
662
563
2017-12-10T20:12:42Z
Henry
1
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="text">ldr r2, =Data
ldr r3, [r2]
ldr r4, [r3, #1]
ldr r5, [r4, #2]
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r5 equals r2</li>
<li>r2, r3, and r4 are all different</li></ul>
{{ExampleBox|[None]|2=r2=r5 |3=
// Declare something
.data
.text
.global _start
_start:
ldr r2, =Data
ldr r3, [r2]
ldr r4, [r3, #1]
ldr r5, [r4, #2]
1: b 1b // Done
}}
{{HintBox|Your <tt>.word</tt> declarations can contain simple arithmetic operations.}}
{{SubmitBox|arch=arm}}
9629b7fe74b8504047228073d5356cd1485962a2
Nios/loaddecl4
0
133
663
352
2017-12-10T20:13:00Z
Henry
1
wikitext
text/x-wiki
Consider the assembly code snippet below:
<syntaxhighlight lang="gas">movia r2, Data
ldw r3, 0(r2)
ldw r4, 1(r3)
ldw r5, 2(r4)
</syntaxhighlight>
Declare some data in memory such that the result of running the code is: <ul>
<li>r5 equals r2</li>
<li>r2, r3, and r4 are all different</li></ul>
{{ExampleBox|[None]|2=r2=r5 |3=
# Declare something
.global _start
_start:
movia r2, Data
ldw r3, 0(r2)
ldw r4, 1(r3)
ldw r5, 2(r4)
1: br 1b # Done
}}
{{HintBox|Your <tt>.word</tt> declarations can contain simple arithmetic operations.}}
{{SubmitBox|arch=nios2}}
38b3de5af8b1a7818347bcef430f46808eb3509c
Nios/zeroext
0
102
664
311
2017-12-11T05:14:51Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
<source lang="c">unsigned int zeroext(unsigned int n);</source>
{{ExampleBox|0xf0|0x000000f0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 0xf0 # First parameter is always in r4
call zeroext
br _start # End of testing code
# A function to zero extend. Only this part will be tested.
zeroext:
}}
{{SubmitBox|arch=nios2}}
88067e8afeb23b32beb554f68537b5d760c28814
Arm/zeroext
0
186
665
637
2017-12-11T05:14:56Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>zeroext</tt>) that will zero-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
<source lang="c">unsigned int zeroext(unsigned int n);</source>
{{ExampleBox|0xf0|0x000000f0|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0xf0 // First parameter is always in r0
bl zeroext
b _start // End of testing code
// A function to zero extend. Only this part will be tested.
zeroext:
}}
{{SubmitBox|arch=arm}}
cc5f80d9424f0b78b3f813870a0338106cec152d
Arm/signext
0
185
666
636
2017-12-11T05:15:54Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
<source lang="c">int signext(char n);</source>
{{ExampleBox|0xf0|0xfffffff0|3=
// A test case to test your function with
.global _start
_start:
mov r0, #0xf0 // First parameter is always in r0
bl signext
b _start // End of testing code
// A function to sign extend. Only this part will be tested.
signext:
}}
{{SubmitBox|arch=arm}}
908de79bf8bef504049b518579e0fa30481eeffc
Nios/signext
0
101
667
310
2017-12-11T05:15:58Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>signext</tt>) that will sign-extend an 8-bit input number (the lowest 8 bits of the function parameter) to 32 bits. The upper 24 bits of the input number should be ignored (and may not necessarily be zero).
<source lang="c">int signext(char n);</source>
{{ExampleBox|0xf0|0xfffffff0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 0xf0 # First parameter is always in r4
call signext
br _start # End of testing code
# A function to sign extend. Only this part will be tested.
signext:
}}
{{SubmitBox|arch=nios2}}
21d3650120ada0fd5b5de7d892677b303622b76f
Nios/extend
0
103
668
313
2017-12-11T05:16:55Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r2). The first function parameter (in r4) specifies which operation to do, while the second parameter holds the number to extend:
<ul><li>r4 = 0: Zero extend 8 bit to 32 bit</li>
<li>r4 = 1: Zero extend 16 bit to 32 bit</li>
<li>r4 = 2: Sign extend 8 bit to 32 bit</li>
<li>r4 = 3: Sign extend 16 bit to 32 bit</li>
</ul>
<source lang="c">int extend(int operation, int n);</source>
{{ExampleBox|extend(2,0xf0)|2=r2=0xfffffff0|3=
# A test case to test your function with
.global _start
_start:
movi r4, 2 # 2 = sign extend 8->32
movi r5, 0xf0 # The number to extend
call extend
br _start # End of testing code
# A function to extend. Only this part will be tested.
extend:
}}
{{SubmitBox|arch=nios2}}
2e2cddfea03ea8b1c0a6145ff504e384dce32920
Arm/extend
0
187
669
518
2017-12-11T05:17:00Z
Henry
1
wikitext
text/x-wiki
Write a function (named <tt>extend</tt>) that will extend a number to 32 bits and return the extended number (in r0). The first function parameter (in r0) specifies which operation to do, while the second parameter holds the number to extend:
<ul><li>r0 = 0: Zero extend 8 bit to 32 bit</li>
<li>r0 = 1: Zero extend 16 bit to 32 bit</li>
<li>r0 = 2: Sign extend 8 bit to 32 bit</li>
<li>r0 = 3: Sign extend 16 bit to 32 bit</li>
</ul>
<source lang="c">int extend(int operation, int n);</source>
{{ExampleBox|extend(2,0xf0)|2=r0=0xfffffff0|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =2 // 2 = sign extend 8->32
ldr r1, =0xf0 // The number to extend
bl extend
b _start // End of testing code
// A function to extend. Only this part will be tested.
extend:
}}
{{HintBox|The BIC (bit clear) instruction may be useful.}}
{{SubmitBox|arch=arm}}
7c719d2c724e333072b707eaa05ea62111009bb9
Arm/saturate
0
188
670
638
2017-12-11T05:17:48Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around.
Write a function that will convert an unsigned 32-bit number to 16 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the maximum possible unsigned 16-bit value.
<source lang="c">unsigned short saturate(unsigned int n);</source>
{{ExampleBox|0x12345|0xffff|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x12345 // First parameter is always in r0
bl saturate
b _start // End of testing code
// Convert unsigned 32 bit to 16 bit, with saturation
saturate:
}}
{{SubmitBox|arch=arm}}
5e69ab597c7982af5865183a684f63b375200ed2
Nios/saturate
0
104
671
315
2017-12-11T05:17:51Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum possible value rather than wrap around.
Write a function that will convert an unsigned 32-bit number to 16 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the maximum possible unsigned 16-bit value.
<source lang="c">unsigned short saturate(unsigned int n);</source>
{{ExampleBox|0x12345|0xffff|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x12345 # First parameter is always in r4
call saturate
br _start # End of testing code
# Convert unsigned 32 bit to 16 bit, with saturation
saturate:
}}
{{SubmitBox|arch=nios2}}
8fd54cf7b79eacbc045eca1ede7a8557a75c5087
Arm/saturate2
0
189
672
639
2017-12-11T05:18:45Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around.
Write a function that will convert a signed 32-bit number to (signed) 8 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the closest possible signed 8-bit value. Since the output is an 8 bit value, the upper 24 bits of the return value should be zero.
<source lang="c">char saturate(int n);</source>
{{ExampleBox|0x123|0x7f|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x123 // First parameter is always in r0
bl saturate
b _start // End of testing code
// Convert signed 32 bit to 8 bit, with saturation
saturate:
}}
{{SubmitBox|arch=arm}}
686697a3c20b46e247d72d1fbe8bf39272acf306
Nios/saturate2
0
105
673
317
2017-12-11T05:18:51Z
Henry
1
wikitext
text/x-wiki
Sometimes when doing arithmetic, it is better to "saturate" (or clamp) numbers that overflow to the maximum or minimum possible value rather than wrap around.
Write a function that will convert a signed 32-bit number to (signed) 8 bits. If the 32-bit number is too big to fit, saturate (or clamp) the output to the closest possible signed 8-bit value. Since the output is an 8 bit value, the upper 24 bits of the return value should be zero.
<source lang="c">char saturate(int n);</source>
{{ExampleBox|0x123|0x7f|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x123 # First parameter is always in r4
call saturate
br _start # End of testing code
# Convert signed 32 bit to 8 bit, with saturation
saturate:
}}
{{SubmitBox|arch=nios2}}
0eeffe72592ea3cf933d5417269a51b09754ddd3
Nios/bits1
0
116
674
328
2017-12-11T05:22:35Z
Henry
1
wikitext
text/x-wiki
An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given number, in unsigned binary representation.
<source lang="c">unsigned int bits(unsigned int num);</source>
{{ExampleBox|0x1000|2=r2=13|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x1000
call bits
br _start # End of testing code
# Return minimum number of bits to represent first parameter
bits:
}}
{{SubmitBox|arch=nios2}}
036899f046f8f83a47c8f845a28d3a0dc025d053
Arm/bits1
0
199
675
536
2017-12-11T05:22:39Z
Henry
1
wikitext
text/x-wiki
An unsigned number of ''n'' bits can represent values between 0 and 2<sup>n</sup>-1, inclusive. Write a function that returns how many bits are needed to represent a given number, in unsigned binary representation.
<source lang="c">unsigned int bits(unsigned int num);</source>
{{ExampleBox|0x1000|2=r0=13|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|The <tt>CLZ</tt> (count leading zeros) instruction may be useful.}}
{{SubmitBox|arch=arm}}
eee4b3d628b2a71fd5844ae4ac3a0c51d0e41545
Nios/bits2
0
117
676
329
2017-12-11T05:22:58Z
Henry
1
wikitext
text/x-wiki
A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits are needed to represent a given number, in signed binary representation.
<source lang="c">unsigned int bits(int num);</source>
{{ExampleBox|0x1000|2=r2=13|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x1000
call bits
br _start # End of testing code
# Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|Think carefully about corner cases...}}
{{SubmitBox|arch=nios2}}
490766393f1f65a51f67adf403773d6f05fc6d66
Arm/bits2
0
200
677
537
2017-12-11T05:23:07Z
Henry
1
wikitext
text/x-wiki
A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits are needed to represent a given number, in signed binary representation.
<source lang="c">unsigned int bits(int num);</source>
{{ExampleBox|0x1000|2=r0=13|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|Think carefully about corner cases...}}
{{SubmitBox|arch=arm}}
1f4fc1479d55e6404a4595cf15317d4fe189127c
686
677
2017-12-28T20:43:25Z
Henry
1
wikitext
text/x-wiki
A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits are needed to represent a given number, in signed binary representation.
<source lang="c">unsigned int bits(int num);</source>
{{ExampleBox|0x1000|2=r0=14|3=
// A test case to test your function with
.global _start
_start:
ldr r0, =0x1000
bl bits
b _start // End of testing code
// Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|Think carefully about corner cases...}}
{{SubmitBox|arch=arm}}
65f3e218ddd49f3a6a64c5214cce06c81e566abe
Arm/maxs8
0
195
678
529
2017-12-13T20:13:21Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 8-bit signed bytes.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">int max ( unsigned int length, char *array );</source>
{{ExampleBox|[1, 2, 3]|2=r0=3|3=
// A test case to test your function with
.data
Array: .byte 1, 2, 3
.text
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl max
b _start // End of testing code
// Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=arm}}
c6c5cdec4684cf5d0d38fedc5ce253a78a9a70a9
Nios/maxs8
0
114
679
326
2017-12-13T20:13:25Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 8-bit signed bytes.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">int max ( unsigned int length, char *array );</source>
{{ExampleBox|[1, 2, 3]|2=r2=3|3=
# A test case to test your function with
Array: .byte 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call max
br _start # End of testing code
# Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=nios2}}
1e669ad77d05de06a9006c6c89f6811e63d1e46a
Arm/maxu
0
197
680
532
2017-12-13T20:15:43Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 32-bit unsigned words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">unsigned int max ( unsigned int length, unsigned int *array );</source>
{{ExampleBox|[1, 2, 3]|2=r0=3|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl max
b _start // End of testing code
// Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=arm}}
ad8fdbdfc54210741dd91157f3828fc4b03f977b
Nios/maxu
0
112
681
324
2017-12-13T20:15:48Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the maximum value out of an array of 32-bit unsigned words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">unsigned int max ( unsigned int length, unsigned int *array );</source>
{{ExampleBox|[1, 2, 3]|2=r2=3|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call max
br _start # End of testing code
# Return maximum element of unsigned array
max:
}}
{{SubmitBox|arch=nios2}}
a28da5c701ee29c9790e7ea93f8bc38a21a9bcc3
Arm/mins
0
196
682
530
2017-12-13T20:16:16Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the minimum value out of an array of 32-bit signed words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">int max ( unsigned int length, int *array );</source>
{{ExampleBox|[1, 2, 3]|2=r0=1|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl min
b _start // End of testing code
// Return minimum element of signed array
min:
}}
{{SubmitBox|arch=arm}}
0f4b9fb5177c7ff5c9b7b3fd4c6bd1ddd7bcc335
684
682
2017-12-13T20:17:00Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the minimum value out of an array of 32-bit signed words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">int min ( unsigned int length, int *array );</source>
{{ExampleBox|[1, 2, 3]|2=r0=1|3=
// A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
ldr r0, =3
ldr r1, =Array
bl min
b _start // End of testing code
// Return minimum element of signed array
min:
}}
{{SubmitBox|arch=arm}}
9334e65426d8b9fa41743d48b8d60f672536c971
Nios/mins
0
113
683
325
2017-12-13T20:16:49Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the minimum value out of an array of 32-bit signed words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">int max ( unsigned int length, int *array );</source>
{{ExampleBox|[1, 2, 3]|2=r2=1|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call min
br _start # End of testing code
# Return minimum element of signed array
min:
}}
{{SubmitBox|arch=nios2}}
1a3a985930124e7d4611fdaa37ef22c250f39013
685
683
2017-12-13T20:17:04Z
Henry
1
wikitext
text/x-wiki
Write a function that returns the minimum value out of an array of 32-bit signed words.
The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.
<source lang="c">int min ( unsigned int length, int *array );</source>
{{ExampleBox|[1, 2, 3]|2=r2=1|3=
# A test case to test your function with
Array: .word 1, 2, 3
.global _start
_start:
movia r4, 3
movia r5, Array
call min
br _start # End of testing code
# Return minimum element of signed array
min:
}}
{{SubmitBox|arch=nios2}}
432918424c2324c40bdd429654bde0bbe52e1420
Arm/ifthen
0
254
687
2017-12-28T23:10:59Z
Henry
1
Created page with "You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples,..."
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r0=5|2=add_a, add_c, and done are called|3=
// You may uncomment these during testing
// add_a: ret
// add_b: ret
// add_c: ret
// add_d: ret
// add_e: ret
// done: ret
.global _start
_start:
ldr r0, =5 // First function parameter is always passed through r4.
bl build
1: b 1b // Done
build:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// ARM: Return by popping lr directly into pc
pop {pc}
}}
{{SubmitBox|arch=arm}}
f5dd2851c8c64467187171bfee83c09feff7278c
688
687
2017-12-28T23:11:49Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> after all requested items have been added to the plate.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r0=5|2=add_a, add_c, and done are called|3=
// You may uncomment these during testing
// add_a: ret
// add_b: ret
// add_c: ret
// add_d: ret
// add_e: ret
// done: ret
.global _start
_start:
ldr r0, =5 // First function parameter is always passed through r0.
bl build
1: b 1b // Done
build:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// ARM: Return by popping lr directly into pc
pop {pc}
}}
{{SubmitBox|arch=arm}}
52c6d83d5c1d90e331a5a17a455791ef8b90e21d
Nios/func pack20
0
76
689
218
2017-12-29T01:47:22Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
Recall that the first 4 parameters of a function are passed through registers <tt>r4</tt> to <tt>r7</tt>, while the rest are passed through the stack.
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20001], ... 22 to [0x20013] | 3=
.global _start
_start:
movia sp, 0x04000000 # Initial SP
movia r4, 0x20000
movi r5, 22
movi r6, 17
1: subi sp, sp, 4 # Push 17 parameters
stw r5, (sp)
subi r5, r5, 1
subi r6, r6, 1
bne r6, r0, 1b
movi r5, 3
movi r6, 4
movi r7, 5
call pack20
addi sp, sp, 68 # Caller cleans up the stack: Remove 17 parameters.
1: br 1b # done
.global pack20
pack20: }}
{{SubmitBox|arch=nios2}}
f46cccbfb5870766622e4ebf036951d8e3ce383f
Arm/func pack20
0
40
690
186
2017-12-29T01:47:38Z
Henry
1
wikitext
text/x-wiki
Write a function that stores 20 bytes (char) into consecutive bytes in memory. The function should write <tt>b1</tt>, <tt>b2</tt>, and <tt>b3</tt>, ... <tt>b20</tt> (in that order, lowest to highest address) to the array starting at <tt>array</tt>. The function has 21 parameters. The first is the location of the array, and the remaining 20 parameters are the 20 bytes to store.
There is no return value.
<syntaxhighlight lang="c">void pack20 (char* array, char b1, char b2, ... , char b20);</syntaxhighlight>
Recall that the first 4 parameters of a function are passed through registers <tt>r0</tt> to <tt>r3</tt>, while the rest are passed through the stack.
{{ExampleBox|pack20 ( 0x20000, 3, 4, 5, 6, ... , 22 ); |
Writes 3 to [0x20000], 4 to [0x20001], ... 22 to [0x20013] | 3=
.global _start
_start:
ldr sp, =0x40000000 // Initial SP
ldr r0, =0x20000
mov r1, #22
mov r2, #17
1: push {r1}
sub r1, #1
subs r2, #1
bne 1b
mov r1, #3
mov r2, #4
mov r3, #5
bl pack20
add sp, #68 // Caller cleans up the stack: Remove 17 parameters.
1: b 1b // done
.global pack20
pack20: }}
{{SubmitBox|arch=arm}}
1d903c5acab999068d31a8dbdf069b2fe1af6eef
Template:SubmitBox
10
15
691
427
2018-01-07T05:15:59Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/v1/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), "Sim"+(Math.random().toString(36)+"abcdefghij").substr(2,10) + ".s");
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/v1/?loadasm=samples/share/" + xhr.response.trim();
new_url = new_url + (("default" == "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=armgen") : (String.fromCharCode(0x26) + "sys=gen")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
912df1029c07e756c4c341c5947d7d2e89aebd83
692
691
2018-01-07T07:33:32Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), 'asmbits');
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=share/" + xhr.response.trim();
new_url = new_url + (("default" == "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=arm") : (String.fromCharCode(0x26) + "sys=nios")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
8b6495764a65bc48870e301e6569b7bddd2c1ab0
Nios/uartread
0
160
693
432
2018-01-07T07:45:11Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit [15]: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r2 (the return value) (and <tt>ra</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r2=11
|3=
.data
Out: .skip 256 # Reserve some space for output
.text
#read_uart: # This may be useful for debugging
movia r2, 0xff201000
ldwio r2, 0(r2)
ret
.global _start
_start:
movia sp, 0x04000000 # Initialize SP for debugging.
movia r4, Out # Use Out as the output string
call uartgets
1: br 1b # Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=nios2|simsystem=nios-de1soc}}
d951ca3ade02ee316c40f77bb041fe9c1f046a21
Arm/uartread
0
237
694
594
2018-01-07T07:45:18Z
Henry
1
wikitext
text/x-wiki
Write a function to read a string (terminated with character '\n', or 0x0d) from a UART device and writes that string into memory. You will need to poll the UART device to read each character as it becomes available. Replace the \n character with a null character in the output string. Return the length of the string.
<syntaxhighlight lang="c">unsigned int uartgets (char *output);</syntaxhighlight>
You are provided a function to read the status of the UART: <source lang="c">unsigned int read_uart();</source>
The 32-bit word includes information about the state of the UART and the received character, if available:
<ul><li>bit [15]: 1 if the character in bits [7:0] is valid. If valid, the character is also dequeued from the UART so that the next read will return the next character, if available. If not valid, bits [7:0] in the word are undefined. You need to poll the device to read each character in the string.</li>
<li>bits [7:0]: The character received from the UART, if there was a character available.</li></ul>
To make this problem easier, <tt>read_uart</tt> only clobbers r0 (the return value) (and <tt>lr</tt>, of course).
{{ExampleBox|1="Hello world" | 2=r0=11
|3=
.data
Out: .skip 256 // Reserve some space for output
.text
//read_uart: // This may be useful for debugging
ldr r0, =0xff201000
ldr r0, [r0]
bx lr
.global _start
_start:
ldr sp, =0x04000000 // Initialize SP for debugging.
ldr r0, =Out // Use Out as the output string
bl uartgets
1: b 1b // Done
uartgets:}}
{{HintBox|The definition of the UART device in this problem is compatible with the UART used in the Altera computer systems. In the CPUlator simulator, look for the UART device. You can test your program by focusing on (clicking on) the UART device, then typing. The sample <tt>read_uart</tt> function reads from this UART and can be used for debugging, but remove it before submitting because the judge uses a different implementation. }}
{{SubmitBox|arch=arm|simsystem=arm-de1soc}}
f1f9397cbb22c7355a32eb2557a11a1e840233ef
Nios/return123
0
17
695
650
2018-01-08T22:03:33Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r2) is set to 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r2 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
call func
1: br 1b # done
.global func
func:
# Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
07aab021da668181bfa5afe7c732fca1b8738111
698
695
2018-01-18T02:32:29Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r2) is set to 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>ra</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r2 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
call func
1: br 1b # done
func:
# Set r2 = 123 and then return from the function.}}
{{SubmitBox|arch=nios2}}
ff37e61aade78516a0c40777eeb17c5a6f71f643
Arm/return123
0
16
696
621
2018-01-08T22:03:51Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r0) is set to 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>lr</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
bl func
1: b 1b // done
.global func
func:
// return 123: Set r0 = 123 and then return from the function.
}}
{{SubmitBox|arch=arm}}
e739d7d805ac6894b5f9b6ff40c0c0e9f1e216bd
699
696
2018-01-18T02:35:02Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that returns 123. This implies two things:
* The return value (in r0) is set to 123 (or 0x7b)
* Your function returns to the caller (The return address is <tt>lr</tt>)
If the return value is incorrect, you will see a mismatch in the final contents of <tt>r0 = 0000007b</tt>. If your function correctly returned to the caller, the final line of output will be "Test completed." Otherwise, not returning to the caller will result in <tt>Test did not complete.</tt>
{{ExampleBox| | 123|3=
.global _start
_start:
bl func
1: b 1b // done
func:
// return 123: Set r0 = 123 and then return from the function.
}}
{{SubmitBox|arch=arm}}
3ff7d198ada9c70a4cde1d832d02f309362719af
Nios/return
0
57
697
620
2018-01-18T02:31:27Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, if your function doesn't return correctly, or if it takes too long to run, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
# This is for testing your function
call func # Call your function
# Your function should return here.
1: br 1b # Infinite loop to stop program after testing
func:
# This is where your code starts running when judging.
# Write a function here.
}}
{{HintBox|Nios II uses the <tt>ret</tt> instruction to return from a function}}
{{SubmitBox|arch=nios2}}
5d57e637c6ba51a6197cb4ac059cc8766a839a8c
Arm/return
0
44
700
624
2018-01-18T02:35:12Z
Henry
1
wikitext
text/x-wiki
Write a function named <tt>func</tt> that does nothing and simply returns.
The problems in this collection require you to write '''functions''', <abbr style="font-size:100%;" title="For automatic judging, we want a way for your program to signal that it is complete, rather than having the judge waiting 'sufficiently long' then assuming that the processor state at that time is the intended output of your program.">rather than a program that simply ends with an infinite loop</abbr>, unlike some other assembly programming exercises you may have seen. One side effect is that even your top-level function must follow calling conventions, and will need to save/restore registers as necessary.
If your function correctly returns, the test output will show <b>Test completed</b>. Otherwise, it shows <b>Test did not complete</b>.
We usually show you the results of a few easy test cases, but we keep some of the harder test cases secret and show only Correct/Incorrect.
The code following the <tt>_start</tt> label is for your convenience in writing a program to test your function. There will usually be an example test case written for you to get a feel for what the test input is. Use it as a starting point to test more challenging test input. The <tt>_start</tt> label is not used when judging: the test code directly calls your function.
{{ExampleBox|[No input]|[No output] |3=
.global _start
_start:
// This is for testing your function
bl func // Call your function
// Your function should return here.
1: b 1b // Infinite loop to stop program after testing
func:
// This is where your code starts running when judging.
// Write a function here.
}}
{{HintBox|1=ARM has several common ways to return from a function:
* <tt>mov pc, lr</tt>
* <tt>bx lr</tt>
* <tt>push {lr} ; ... ; pop {pc}</tt>
The ARMv7-A Architecture Reference Manual ([https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf#page=160 section A4.1.1]) recommends against using the first option because it can only switch modes from ARM to Thumb, while the latter two can switch processor modes in both directions.}}
{{SubmitBox|arch=arm}}
dcac8be3e75d9e69d70fd34e718213166b35d238
MediaWiki:Sidebar
8
4
701
615
2018-03-10T10:55:38Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II, ARMv7, and MIPS simulator
* SEARCH
* TOOLBOX
* LANGUAGES
d2968dd854638bfd73bd568877e327440edad364
MediaWiki:Sidebar
8
4
702
701
2018-03-10T10:56:29Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://www.01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II, ARMv7, and MIPS simulator
* SEARCH
* TOOLBOX
* LANGUAGES
e15765c9ac08b25aa20045fbd08d9a3652684ce0
703
702
2018-03-10T10:57:03Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/?sys=nios|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
** https://cpulator.01xz.net/?sys=mips|Run a Simulation (MIPS)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://www.01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II, ARMv7, and MIPS simulator
* SEARCH
* TOOLBOX
* LANGUAGES
6dd4df8fa3238fb51fb94df055babd115357b318
707
703
2019-01-27T23:26:33Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/?sys=nios|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
** https://cpulator.01xz.net/?sys=mipsr5|Run a Simulation (MIPS)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://www.01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II, ARMv7, and MIPS simulator
* SEARCH
* TOOLBOX
* LANGUAGES
4ac2a61db1cf8cb0199cec5e8e011350d539ec4b
708
707
2019-01-27T23:27:22Z
Henry
1
wikitext
text/x-wiki
* Problem Set
** Nios index|Problem Set (Nios II)
** Arm index|Problem Set (ARMv7)
** Special:VlgStats|Problem Set Stats
** Special:VlgRank|User Rank List
* Simulation
** https://cpulator.01xz.net/?sys=nios|Run a Simulation (Nios II)
** https://cpulator.01xz.net/?sys=arm|Run a Simulation (ARMv7)
** https://cpulator.01xz.net/?sys=mipsr5-spim|Run a Simulation (MIPS)
* My Profile
** Special:VlgLogin|Log in/out
** Special:VlgProfile|Profile Settings
** Special:VlgStats/Me|My Stats
* Help
** Project:About|About ASMBits
** Special:Contact/feedback|Bugs and Suggestions
* 01xz.net
** https://www.01xz.net/|01xz.net Home
** https://hdlbits.01xz.net/|HDLBits — Verilog practice
** https://asmbits.01xz.net/|ASMBits — Assembly language practice
** https://cpulator.01xz.net/|CPUlator — Nios II, ARMv7, and MIPS simulator
* SEARCH
* TOOLBOX
* LANGUAGES
b91b689fb794f79939028f07bfe36a1d0a780b88
MediaWiki:Foreground.css
8
5
704
627
2018-10-30T08:57:24Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Roboto:300,300i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Roboto", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Roboto", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Roboto", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
select#uiload_select {
font-size: 13px;
padding: 2px;
margin: 0.5em 0;
}
button#uiload_load {
margin: 0.5em;
padding: 0.3em 0.75em;
font-size: 13px;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
white-space: nowrap;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
max-width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em 2em;}
div.htableform table { margin: auto; width:100%; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu {
margin-top: 2em;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
}
div#pmenu_menu::before {
content: "";
}
}
70c3593d887112d6b67a67ae0d2417725208fd46
705
704
2018-10-30T08:58:31Z
Henry
1
css
text/css
/*
@import 'https://fonts.googleapis.com/css?family=Roboto:300,300i,700|Roboto+Mono:300,700|Open+Sans:700';
Font loading moved to LocalSettings.php
*/
body {
font-family: "Roboto", "Trebuchet MS", sans-serif;
}
p {
margin-top:0.7em;
}
h1,h2,h3,h4,h5,h6 {
font-family: "Open Sans", sans-serif;
font-weight: 700;
margin: 0.8em 0 0.4em 0em;
}
/* Logo */
div.title-name {
font-family: "Roboto", sans-serif;
font-weight: 300;
font-size: 70%;
}
.top-bar-section ul,li.has-dropdown {
font-family: "Roboto", sans-serif;
font-size: 18.5px;
}
.top-bar input {
height: 1.8em;
margin-bottom: 2px;
max-width: 50vw; /* Try to avoid wrapping */
}
.top-bar .button{
padding-top: 0.3em;
padding-bottom: 0.3em;
margin-bottom: 2px;
top: 1px;
}
.top-bar .button.search {
margin-left: -4px;
}
svg {
max-width: 100%;
}
@media only screen and (max-width: 540px) {
body {
font-size: 85%;
}
}
@media only screen and (min-width: 58.75em) {
.top-bar input, .top-bar .button {
height: 1.7em;
line-height: 1.7em;
padding-top: 0;
padding-bottom: 0;
}
}
/* Custom Foreground menubar colors */
.top-bar,
.top-bar-section ul,
.top-bar-section ul li.active > a,
.top-bar-section li a:not(.button),
.top-bar-section .has-form {
background: #01579b;
color: #fff;
}
.top-bar.expanded .title-area {
background: #01355e;
}
.top-bar-section > ul > .divider,
.top-bar-section > ul > [role="separator"] {
border-color: #ef6c00;
}
/* Darker color for the hover over items */
.top-bar-section ul li.hover > a,
.top-bar-section ul li ul.dropdown li.hover > a {
background: #0288d1;
}
/* Slightly darker color for the dropdowns */
.top-bar-section ul li ul.dropdown li > a {
background: #0277bd;
}
.top-bar-section .dropdown li a {
padding: 11px 25px;
}
.top-bar-section .dropdown li.title h5 {
margin-top: 0;
margin-bottom: 0;
}
li#personal-tools-dropdown {
display: none;
}
ul#top-bar-right > li:nth-of-type(4), ul#top-bar-right > li:nth-of-type(3), ul#top-bar-right > li:nth-of-type(2) {
display: none;
}
h3#tagline {
display: none;
}
h4.namespace.label {
display: none;
}
li#footer-privacy,li#footer-disclaimer {
display:none;
}
pre {
font-family: "Roboto Mono", monospace;
font-size: 94%;
}
table {
width: initial;
}
.CodeMirror {
font-family: "Roboto Mono", monospace;
}
code,tt {
font-family: "Roboto Mono", monospace;
}
div.toc {
font-size: 80%;
background-color: #f8f8f8;
border: 1px #999 solid;
padding: 1.5em;
margin: 1em 0 1em 1em;
display:inline-block;
}
@media only screen and (min-width: 58.75em) {
div.toc {
float: right;
}
}
div.toc ul {
list-style-type: none;
}
div.toc h2 {
display:inline;
padding: 0;
font-size: 150%;
}
#wpTextbox1 {
font-family: "Roboto Mono", monospace;
}
input[type="button"].submit, div#solnbox button {
background-color: #5da423;
border-color: #457a1a;
color: white;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
-webkit-transition: background-color 300ms ease-out;
-moz-transition: background-color 300ms ease-out;
transition: background-color 300ms ease-out;
}
div#submitbox input[type="button"][disabled].submit, div#submitbox input[type="submit"][disabled] {
background-color: #909090;
border-color: #a0a0a0;
cursor: wait;
}
div#solnbox button[disabled] {
background-color: #909090;
border-color: #a0a0a0;
}
button#solnbox_show {
margin-top: 1em;
font-weight: normal;
float: right;
}
select#uiload_select {
font-size: 13px;
padding: 2px;
margin: 0.5em 0;
}
button#uiload_load {
margin: 0.5em;
padding: 0.3em 0.75em;
font-size: 13px;
}
@media only screen and (max-width: 480px) {
button#solnbox_show {
margin-top: 0.25em;
float: none;
width: 100%;
}
div#solnbox h3 {
display: none;
}
}
a.vlgstat_link {
line-height: 1.2em;
padding: 0.2em 0;
}
/* Stuff copied from elements.css */
textarea {
width: 100%;
padding: .1em;
display: block;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* Emulate Center */
.center {
width: 100%;
text-align: center;
}
*.center * {
margin-left: auto;
margin-right: auto;
}
/* Small for tables and similar */
.small {
font-size: 94%;
}
table.small {
font-size: 100%;
}
/* End stuff copied from elements.css */
/* Stuff copied from content.css */
/* Images */
/* @noflip */div.floatright, table.floatright {
margin: 0 0 .5em .5em;
border: 0;
}
div.floatright p {
font-style: italic;
}
/* @noflip */div.floatleft, table.floatleft {
margin: 0 .5em .5em 0;
border: 0;
}
div.floatleft p {
font-style: italic;
}
/* Thumbnails */
div.thumb {
margin-bottom: .5em;
width: auto;
background-color: transparent;
}
div.thumbinner {
border: 1px solid #ccc;
padding: 3px;
background-color: #f9f9f9;
font-size: 94%;
text-align: center;
overflow: hidden;
}
html .thumbimage {
border: 1px solid #ccc;
}
html .thumbcaption {
border: none;
line-height: 1.4em;
padding: 3px;
font-size: 94%;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
text-align: left;
}
div.magnify {
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
float: right;
margin-left: 3px;
}
div.magnify a {
display: block;
/* Hide the text\u2026 */
text-indent: 15px;
white-space: nowrap;
overflow: hidden;
/* \u2026and replace it with the image */
width: 15px;
height: 11px;
/* Default styles when there's no .mw-content-ltr or .mw-content-rtl, overridden below */
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
/* Don't annoy people who copy-paste everything too much */
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
img.thumbborder {
border: 1px solid #dddddd;
}
/* Directionality-specific styles for thumbnails - their positioning depends on content language */
/* @noflip */
.mw-content-ltr .thumbcaption {
text-align: left;
}
/* @noflip */
.mw-content-ltr .magnify {
float: right;
margin-left: 3px;
margin-right: 0;
}
/* @noflip */
.mw-content-ltr div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-ltr.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-ltr.svg);
}
/* @noflip */
.mw-content-rtl .thumbcaption {
text-align: right;
}
/* @noflip */
.mw-content-rtl .magnify {
float: left;
margin-left: 0;
margin-right: 3px;
}
/* @noflip */
.mw-content-rtl div.magnify a {
/* Use same SVG support hack as mediawiki.legacy's shared.css */
background-image: url(images/magnify-clip-rtl.png);
/* @embed */
background-image: linear-gradient(transparent, transparent), url(images/magnify-clip-rtl.svg);
}
/* @noflip */
div.tright {
margin: .5em 0 1.3em 1.4em;
}
/* @noflip */
div.tleft {
margin: .5em 1.4em 1.3em 0;
}
/* End stuff copied from content.css */
div.htableform td { vertical-align: middle; }
div.htableform { margin: auto;
border: 0;
max-width: 28em;
display: block;
background-color: #E1F5FE;
padding: 1em 2em;}
div.htableform table { margin: auto; width:100%; background-color: transparent; border: 0;}
div.htableform form { margin: 0; }
div.htableform table tr { background-color: transparent; }
div.htableform table tr td { padding: 0.2em 0.625em; }
div.htableform input[type=submit] { margin-right: 0; margin-left: 1em; padding: 1ex 1em; }
div.htableform input[type=text], div.htableform input[type=password] { margin: 0.5ex 1em; width: 100%;}
span.hdlbits-stat-icon {
display: inline-block;
margin: 0px 3px 0px 2px;
color: #d8d8d8;
}
span.hdlbits-stat-icon.hdlbits-stat-tried {
color: #ffb300;
}
span.hdlbits-stat-icon.hdlbits-stat-done {
color: #4caf50;
}
pre.code {
margin-left: 1em;
}
.hlist dl,.hlist ol,.hlist ul {
margin: 0;
padding: 0
}
.hlist dd,.hlist dt,.hlist li {
margin: 0;
display: inline
}
.hlist.inline,.hlist.inline dl,.hlist.inline ol,.hlist.inline ul,.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul {
display: inline
}
.hlist dd:after,.hlist li:after {
content: " · ";
font-weight: bold
}
.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after {
content: none
}
li#p-01xz\.net > a {
font-weight: normal;
}
/* ProblemMenu */
div.row.with_menu {
max-width: 83em;
position:relative;
}
div#pmenu_menu {
margin-top: 2em;
}
div#pmenu_menu::before {
content: "Problem Set Contents";
font-size: 1.6875em;
font-weight: 700;
font-family: "Open Sans", sans-serif;
}
ul#pmenu_top ul {
display: none;
}
ul#pmenu_top li.pmenu_open>ul {
display: block;
}
ul#pmenu_top li.pmenu_hdr.pmenu_open:before {
content: "\f0d7";
}
ul#pmenu_top li.pmenu_hdr:before {
font-family:"FontAwesome";
content: "\f0da";
width: 0.8em;
display: inline-block;
}
ul#pmenu_top {
margin-left: 0;
overflow: hidden;
margin-top: 0.4em;
}
ul#pmenu_top li {
list-style: outside;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
list-style: none;
padding-left: 1em;
}
ul#pmenu_top li {
font-weight: normal;
}
ul#pmenu_top li.pmenu_cur {
font-weight: bold;
}
ul#pmenu_top li.pmenu_cur_leaf {
background-color: #b3e5fc;
font-weight: bold;
}
ul#pmenu_top a {
display:block;
padding-left: 0.25em;
}
ul#pmenu_top a:hover {
background-color: #d9f3ff;
}
ul#pmenu_top ul {
margin-left: 0em;
border-left: 1px solid #e0f4ff;
}
@media only screen and (min-width: 58.75em) {
div#pmenu_body {
padding-left: 15em;
}
div#pmenu_menu {
width: 15em;
position: absolute;
padding-left: 0.25em;
}
ul#pmenu_top {
font-size: 80%;
}
div#pmenu_menu::before {
content: "";
}
}
33ebdd7f57b0c8b42f5b3b50f45e10ef4056a249
Template:SubmitBox
10
15
706
692
2018-10-30T08:59:25Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
</html><vlg_uiload/><html>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".v,.sv" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), 'asmbits');
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=share/" + xhr.response.trim();
new_url = new_url + (("default" == "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=arm") : (String.fromCharCode(0x26) + "sys=nios")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
ae95fd55c18cffd9a7026a61cab16c26254cc40f
709
706
2019-01-28T09:41:35Z
Henry
1
wikitext
text/x-wiki
<div class="hb-box" id="submitbox"><html>
<h3>Write your solution here</h3>
</html><vlg_uiload/><html>
<script type="text/javascript">
function checkCode() {
var success = true;
var codetext = editor.getValue();
return success;
}
function pause_btn(btn) {
setTimeout(function(){btn.disabled = true;}, 0);
setTimeout(function(){btn.disabled=false;}, 4000);
}
</script>
<div class="hb-subbox">
<form id="codeform" action="/runsim.php" method="post" enctype="multipart/form-data" onSubmit="return checkCode()" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>"><div style="border: 1px #999 solid">
<textarea rows="15" name="vlgcode_box" spellcheck="false" id="codesubmitbox" onload="updateCodebox();">.global </html>{{{entry|_start}}}<html>
</html>{{{entry|_start}}}<html>:
</textarea></div>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<input id="submitiframe" type="button" class="submit" value="Submit">
<input name="sbnew" type="submit" value="Submit (new window)" onclick="pause_btn(this); this.form.submit();">
<input id="submitshare" type="button" class="submit" value="Debug in CPUlator">
</form>
</div>
<a href="#" onclick="$('#submituploaddiv').show(); $(this).hide(); return false;" style="font-size:80%; line-height: 80%; display: block;">Upload a source file... <i class="fa fa-angle-double-down" style="margin-left:0.5em; font-size:120%" aria-hidden="true"></i></a>
<div id="submituploaddiv" style="display:none;"><h3>Or upload a file</h3>
<div class="hb-subbox">
<form action="/runsim.php" method="post" enctype="multipart/form-data" target="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>">
Assembly source: <input type="file" name="vlgcode" accept=".s,.asm" size=50>
<input type="hidden" name="tc" value="</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>" >
<br><input type="submit" value="Upload" onclick="pause_btn(this); poll_soln(); this.form.submit();">
</form>
</div></div>
<script type="text/javascript">
var pl = document.getElementById('portlistbox');
var text = "";
if (pl) {
if (pl.textContent.length != 0) { text = pl.textContent + "\n\t\n\t"; }
}
pl = document.getElementById('codeloadbox');
if (pl) {
if (pl.textContent.length) { text = pl.textContent; }
}
if (text != "") {
document.getElementById('codesubmitbox').value = text.replace(/\xa0/g, ' ');
}
</script>
<link rel="stylesheet" href="/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/codemirror/theme/neat.css">
<style>
.CodeMirror {height: auto; font-family: "Roboto Mono", monospace; font-size: 81.25%;}
.CodeMirror-scroll { min-height: 180px; }
</style>
<script src="/codemirror/lib/codemirror.js"></script>
<script src="/codemirror/mode/gas/gas.js"></script>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('codesubmitbox'), {
lineNumbers: true,
theme: "neat",
indentUnit: 4,
height: "dynamic",
mode: {name: "gas", architecture: "</html>{{{arch|arm}}}<html>"},
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
document.getElementById('submitiframe').onclick = function() {
var form=document.getElementById('codeform');
var oldtarget = form.target;
form.target = 'compile_iframe';
form.submit();
form.target = oldtarget;
var ifr = document.getElementById('compile_iframe');
ifr.style.display = "block";
ifr.scrollIntoView(true);
ifr.onload = update_soln;
pause_btn(this);
}
document.getElementById('submitshare').onclick = function() {
var new_window = window.open("", "_blank");
var xhr = new XMLHttpRequest();
xhr.open("POST", "//cpulator.01xz.net/share.php");
var data = new FormData();
data.append('file', new Blob([editor.getValue()]), 'asmbits');
xhr.responseType = "text";
xhr.onload = function() {
var new_url = "//cpulator.01xz.net/?loadasm=share/" + xhr.response.trim();
new_url = new_url + (("default" == "</html>{{{simsystem|default}}}<html>") ? ("</html>{{{arch|arm}}}<html>" == "arm" ? (String.fromCharCode(0x26) + "sys=arm") : (String.fromCharCode(0x26) + "sys=nios")) : (String.fromCharCode(0x26) + "sys=" + "</html>{{{simsystem|}}}<html>"));
new_window.location = new_url;
}
xhr.send(data);
pause_btn(this);
}
if (document.getElementById('codeloadbox')) {
document.getElementById('submitshare').style.display="inline-block";
}
var vlg_tc_stat;
window.addEventListener('beforeunload', function(e){
if (editor.isClean()) return;
if (vlg_tc_stat.status == 2) return; // Problems is completed.
e.returnValue = "The contents of the editor won't be saved.";
});
</script></html></div><html>
<script>
function show_soln(btn) {
$('#solnbox_div').show();
var editor_soln = CodeMirror.fromTextArea(document.getElementById('solnbox_box'), {
lineNumbers: true,
theme: "neat",
readOnly: true,
indentUnit: 4,
height: "dynamic",
viewportMargin: Infinity,
specialChars: /[\t\u00a0\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g
});
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?show_sln\u0026tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
editor_soln.setValue(r.sln_data);
show_soln = function(){return true;};
update_soln = function(){return true;};
btn.disabled = true;
}
xhr.send();
return true;
}
function update_soln() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/tcstat.php?tc=</html>{{{1|{{lcfirst:{{PAGENAMEE}}}}}}}<html>");
xhr.responseType = "text";
xhr.onload = function() {
var r = JSON.parse(xhr.response);
vlg_tc_stat = r;
if (r.has_sln) {
if (r.status < 2) {
btn = document.getElementById('solnbox_show');
btn.innerText="Complete problem first to see solution";
btn.disabled=true;
document.getElementById('solnbox').style.display="block";
}
else {
btn = document.getElementById('solnbox_show');
btn.innerText="Show solution";
btn.disabled=false;
document.getElementById('solnbox').style.display="block";
problem_is_completed = true;
}
}
}
xhr.send();
};
var poll_soln_timerid;
function poll_soln() {
var i = 13;
clearTimeout(poll_soln_timerid);
function tmp() {
update_soln();
if (i--) {
poll_soln_timerid=setTimeout(tmp, 10000);
}
};
poll_soln_timerid=setTimeout(tmp, 10000);
}
</script>
<div class="hb-box" id="solnbox" style="display:none">
<html><button id="solnbox_show" onClick="show_soln(this);" disabled>Show solution</button><h3>Solution</h3>
<div style="display:none; border: 1px #999 solid" id="solnbox_div"><textarea id="solnbox_box">Loading...</textarea></div><script>
update_soln();
</script></div>
</html>
<html>
<style>
iframe#compile_iframe {
width: 240px;
min-width: 100%;
border: 1px #999 solid;
height: 70em;
display:none;
padding-right: 0.02px;
}
</style>
<iframe id="compile_iframe" name="compile_iframe" scrolling="no"> </iframe>
</html>
2cbe0ca0c070a9f2052bf1a361f423666acfca36
Nios/bits2
0
117
710
676
2019-04-23T08:33:00Z
Henry
1
wikitext
text/x-wiki
A signed (two's complement) number of ''n'' bits can represent values between -2<sup>n-1</sup> and +(2<sup>n-1</sup>-1), inclusive. Write a function that returns how many bits are needed to represent a given number, in signed binary representation.
<source lang="c">unsigned int bits(int num);</source>
{{ExampleBox|0x1000|2=r2=14|3=
# A test case to test your function with
.global _start
_start:
movia r4, 0x1000
call bits
br _start # End of testing code
# Return minimum number of bits to represent first parameter
bits:
}}
{{HintBox|Think carefully about corner cases...}}
{{SubmitBox|arch=nios2}}
a5bec4fd5c892479fff9d2b186c3898fa16fc489
Arm/decstr1
0
193
711
525
2020-01-21T07:20:28Z
Henry
1
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The number is guaranteed to fit within an unsigned 32-bit number.
{{ExampleBox|"1234"|2=r0=1234 (or 0x4d2)|3=
// A test case to test your function with
.data
Str: .string "1234"
.text
.global _start
_start:
ldr r0, =Str
bl decstr
b _start // End of testing code
// Parse a decimal string
decstr:
}}
{{SubmitBox|arch=arm}}
eca10ca19c0c051b9f678fb2c50f5307f0ea2549
Arm/decstr2
0
194
712
527
2020-01-21T07:20:44Z
Henry
1
wikitext
text/x-wiki
Write a function that reads an ASCII null-terminated string containing decimal digits, and returns the value of the number. The string may start with '-' to indicate a negative number, and the remaining characters are decimal digits. The number is guaranteed to fit within an signed 32-bit number.
{{ExampleBox|"1234"|2=r0=1234 (or 0x4d2)|3=
// A test case to test your function with
.data
Str: .string "1234"
.text
.global _start
_start:
ldr r0, =Str
bl decstr
b _start // End of testing code
// Parse a decimal string
decstr:
}}
{{SubmitBox|arch=arm}}
16996e6733f9441923681ae37d955649c2ea1722
Arm/load2
0
210
713
641
2020-01-21T07:27:51Z
Henry
1
wikitext
text/x-wiki
Your function will be passed a pointer to the start of an array of 32-bit words, and an array index. Write a function that reads the index<sup>th</sup> word from memory and returns it.
<syntaxhighlight lang="c">int load (int *pointer, int index);</syntaxhighlight>
{{ExampleBox|1=r0=Data, r1=1
|2=r0=0x124|3=
Data: .word 0x123, 0x124, 0x125
.global _start
_start:
ldr r0, =Data
ldr r1, =1
bl load
1: b 1b // Done
// Dereference a pointer
load:}}
{{SubmitBox|arch=arm}}
ce10711e6697f7e61d2764d8a11ebf82f60bc0b4
Arm/ifelse2
0
233
714
656
2020-01-21T07:27:54Z
Henry
1
wikitext
text/x-wiki
You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You have discovered that food is expensive, but you still want to keep the customer somewhat happy, so you decide to give each customer one (not all) of the items that were requested. To minimise cost, you always give the cheapest item that was requested. The items from cheapest to most expensive are: Apples (cheapest), Bananas, Cherries, Dates, and Edamame (most expensive).
You are provided 6 functions:
<ul><li>add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate</li>
<li>done: Call this when the entire plate is finished</li>
</ul>
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers (but condition codes can be clobbered).
Write a function that will assemble a plate. Out of the items that were requested, choose the cheapest item and call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call <tt>done</tt> when the plate is done.
<syntaxhighlight lang="c">void build (int order);</syntaxhighlight>
It is possible to request an empty plate (in which case, only <tt>done</tt> will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
{{ExampleBox|1=r0=5|2=add_a and done are called|3=
// Some testing code
// You may uncomment these during testing
// add_a: bx lr
// add_b: bx lr
// add_c: bx lr
// add_d: bx lr
// add_e: bx lr
// done: bx lr
.global _start
_start:
ldr r0, =5 // First function parameter is always passed through r0.
bl build
1: b 1b // Done
build:
// Because there are nested function calls, lr needs to be saved and restored.
push {lr}
// Your code here
// Restore lr and return.
pop {pc}
}}
{{SubmitBox|arch=arm}}
33077af1242853cbfe619bab6cf9419c8095752e
Arm/square
0
236
715
591
2020-02-16T22:41:40Z
Henry
1
wikitext
text/x-wiki
Write a function that will draw a white square onto a 640×480, 16 bit per pixel image.
The image is an array of 640 pixels per row (left to right) and 480 rows (top to bottom), where each pixel is 16 bits (2 bytes) (Thus, there are 1280 bytes per row). The top-left corner of the image is pixel (0, 0), while the bottom right is pixel (639, 479). A white pixel has the 16-bit value 0xffff.
Draw a white square of the given size (width and height), with the upper-left corner of the square located at the given left and top pixels. The square will have size at least 1 pixel, and the entire square will fit in the image (you do not need to check for the square exceeding the image boundaries).
<syntaxhighlight lang="c">void square (void* image, int left, int top, int size);</syntaxhighlight>
{{ExampleBox|1=square(Img, 1, 0, 3)|
2=See below|3=
.data
Img: .skip 640*480*2
.text
.global _start
_start:
ldr r0, =Img // Image
ldr r1, =1 // left
ldr r2, =0 // top
ldr r3, =3 // size
bl square
1: b 1b // Done
square:}}
{{SubmitBox|arch=arm}}
a26f4c6cb9559fc305256469ca63ab65bbca93ca
Nios/square
0
159
716
590
2020-02-16T22:41:56Z
Henry
1
wikitext
text/x-wiki
Write a function that will draw a white square onto a 640×480, 16 bit per pixel image.
The image is an array of 640 pixels per row (left to right) and 480 rows (top to bottom), where each pixel is 16 bits (2 bytes) (Thus, there are 1280 bytes per row). The top-left corner of the image is pixel (0, 0), while the bottom right is pixel (639, 479). A white pixel has the 16-bit value 0xffff.
Draw a white square of the given size (width and height), with the upper-left corner of the square located at the given left and top pixels. The square will have size at least 1 pixel, and the entire square will fit in the image (you do not need to check for the square exceeding the image boundaries).
<syntaxhighlight lang="c">void square (void* image, int left, int top, int size);</syntaxhighlight>
{{ExampleBox|1=square(Img, 1, 0, 3)|
2=See below|3=
.data
Img: .skip 640*480*2
.text
.global _start
_start:
movia r4, Img # Image
movi r5, 1 # left
movi r6, 0 # top
movi r7, 3 # size
call square
1: br 1b # Done
square:}}
{{SubmitBox|arch=nios2}}
bf5931ba66f08b8d7729c39e3184afb09a33d061
MediaWiki:Common.css
8
3
717
3
2020-03-30T11:08:18Z
Henry
1
css
text/css
/* CSS placed here will be applied to all skins */
div#p-personal { display: none; }
/* HDLBits stuff */
div.hb-box {
padding: 1ex 1em;
border: 1px #999 solid;
margin: 10px 0px 10px 0px;
}
div#submitbox {
background-color: #fff8e8;
}
div#hintbox {
background-color: #f4f8ff;
}
div#hintbox button {
display:inline;
background-color: transparent;
cursor: pointer;
border:0;
outline: none;
padding:0;
margin-left: -20px; padding-left: 20px;
margin-top: -1ex; padding-top: 1ex;
margin-bottom: 0; padding-bottom: 1ex;
color:#00f; width: 100%; text-align: left;
text-decoration:underline;
font-weight: normal;
}
div#portlistouterbox {
background-color: #f9f9f9;
}
pre#portlistbox{ /* This is the pre inside */
border: 0;
background-color: transparent;
padding:0px 0px 0px 1em;
margin: 0 0 1ex 0;
}
div.hb-subbox input[type=submit], div.hb-subbox input[type=button].submit{
margin-top: 1ex;
padding: 1ex 1em;
}
div.hb-subbox input[type=file] {
width: 22em;
}
span.msgexpl { display: none; }
91bd5d86a6f562ed5783d3a45da34855eee3cc61
718
717
2020-03-30T11:11:03Z
Henry
1
Undo revision 717 by [[Special:Contributions/Henry|Henry]] ([[User talk:Henry|talk]])
css
text/css
/* CSS placed here will be applied to all skins */
div#p-personal { display: none; }
/* HDLBits stuff */
div.hb-box {
padding: 1ex 1em;
border: 1px #999 solid;
margin: 10px 0px 10px 0px;
}
div#submitbox {
background-color: #fff8e8;
}
div#hintbox {
background-color: #f4f8ff;
}
div#hintbox button {
display:inline;
background-color: transparent;
cursor: pointer;
border:0;
outline: none;
padding:0;
margin-left: -20px; padding-left: 20px;
margin-top: -1ex; padding-top: 1ex;
margin-bottom: 0; padding-bottom: 1ex;
color:#00f; width: 100%; text-align: left;
text-decoration:underline;
font-weight: normal;
}
div#portlistouterbox {
background-color: #f9f9f9;
}
pre#portlistbox{ /* This is the pre inside */
border: 0;
background-color: transparent;
padding:0px 0px 0px 1em;
margin: 0 0 1ex 0;
}
div.hb-subbox input[type=submit], div.hb-subbox input[type=button].submit{
margin-top: 1ex;
padding: 1ex 1em;
}
div.hb-subbox input[type=file] {
width: 22em;
}
0ebeccb705b7fe80c2a3290e6e472b1080cdc87a
Nios/normalize
0
121
719
542
2021-04-26T10:05:28Z
Henry
1
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r4: The number of elements in the input (and output) array</li>
<li>r5: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r6: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
There is no return value.
<source lang="c">void normalize(unsigned int length, const unsigned int *input, unsigned short *output);</source>
You may wish to reuse your solutions to <vlgstat tc="nios/maxu"/> and <vlgstat tc="nios/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
# A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
movia r4, 4
movia r5, Input
movia r6, Output
call normalize
br _start # End of testing code
# Normalize to U16
normalize:
}}
{{SubmitBox|arch=nios2}}
d8678b203cabc7847548242a133669a636b8af94
Arm/normalize
0
204
720
633
2021-04-26T10:07:00Z
Henry
1
wikitext
text/x-wiki
Given an array of unsigned 32-bit words (e.g., audio samples), shift all of the samples left or right so that the largest sample will fit into an unsigned 16-bit number. Then write out an array of unsigned 16-bit half-words with the scaled samples.
If the largest (highest amplitude) sample in the input array requires more than 16 bits to store, shift right all of the samples until it fits. If the largest sample requires less than 16 bits to store, left shift all of the samples so that bit 15 of the largest sample is 1. (i.e., increase the amplitude by a power of two as much as possible, while still fitting into 16 bits).
In the example below, the largest sample is 0x80000, which requires 20 bits to represent. Thus, ''all'' of the samples are right-shifted by 4 bits. The largest sample then becomes 0x8000, which requires 16 bits.
The function has three parameters:
<ul><li>r0: The number of elements in the input (and output) array</li>
<li>r1: A pointer to the input array of unsigned 32-bit words. Do not modify this array.</li>
<li>r2: A pointer to the output array of unsigned 16-bit half-words. Write your output here.</li>
</ul>
There is no return value.
<source lang="c">void normalize(unsigned int length, const unsigned int *input, unsigned short *output);</source>
You may wish to reuse your solutions to <vlgstat tc="arm/maxu"/> and <vlgstat tc="arm/bits1"/>.
{{ExampleBox|[0x12345, 0x20000, 0x80000, 0x4000]|[0x1234, 0x2000, 0x8000, 0x400]|3=
// A test case to test your function with
Input: .word 0x10000, 0x20000, 0x80000, 0x4000
Output: .skip 8
.global _start
_start:
ldr r0, =4
ldr r1, =Input
ldr r2, =Output
bl normalize
b _start // End of testing code
// Normalize to U16
normalize:
}}
{{SubmitBox|arch=arm}}
a62c099066c5f6ac6f0264695ca267fa5015a810
MediaWiki:Contactpage-pagetext-feedback
8
6
721
6
2021-07-20T10:19:53Z
Henry
1
wikitext
text/x-wiki
Use this form if you have a suggestion, feedback on the problem set or one particular problem, or a bug to report.
* Is there a bug on one of the problems? Is the problem text unclear or ambiguous?
* Bugs on the site or in the auto-tester?
* Feature requests?
* Comments?
* '''Email addresses at @qq.com''': I suspect qq.com filters out my emails. I have responded to many people who use @qq.com email addresses, but I have never gotten any replies back.
6bf57004ff2d46e93868034fc95dfdc7307dacf7